#C3984. Calculate Coding Time per Participant
Calculate Coding Time per Participant
Calculate Coding Time per Participant
You are given a sequence of log entries each containing a timestamp in HH:MM format and an action: either START
or END
. These log entries represent coding sessions for multiple participants. The log entries are assigned to participants in a round-robin fashion: the first START
belongs to participant 1, the corresponding END
finishes their session, the next START
starts participant 2's session, and so on. When the last participant is reached, the assignment wraps around to participant 1.
Each session's duration is computed using the formula: \( \text{Duration (in minutes)} = \text{END time} - \text{START time} \). If there are no log entries, every participant’s coding time is considered to be 0.
Your task is to calculate the total coding time for each participant.
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer
N
, the number of log entries. - The next
N
lines each contain a log entry in the formatHH:MM ACTION
, whereACTION
is eitherSTART
orEND
. - The last line contains an integer
P
, the number of participants.
outputFormat
Output a single line to stdout with P
integers separated by a space, where the i-th integer represents the total coding time (in minutes) for the i-th participant.
6
09:00 START
10:00 END
11:30 START
12:30 END
13:00 START
14:00 END
3
60 60 60