#K61077. Summarize Reading Sessions
Summarize Reading Sessions
Summarize Reading Sessions
You are given a series of reading sessions. Each session is defined by its start time, end time, and the number of pages read during that session. The goal is to summarize the reading sessions by computing the total number of pages read during each one-hour segment of the day, from 00:00 to 23:59. For each session, only the starting hour is considered for the accumulation of pages.
In mathematical terms, if a session has a start time \(HH:MM\) and \(pagesRead\) pages, then let \(h = HH\) (as an integer) and the total for the \(h^{th}\) hour is increased by \(pagesRead\). Formally, for each reading session, update:
[ \text{hours}[h] := \text{hours}[h] + \text{pagesRead} ]
Finally, print the counts for each hour as 24 space-separated integers.
inputFormat
The input is read from standard input (stdin). The first line contains an integer \(n\) representing the number of reading sessions. Each of the following \(n\) lines has three elements separated by spaces:
- startTime in the format
HH:MM
, - endTime in the format
HH:MM
(this value is ignored in the computation), - pagesRead: an integer indicating the number of pages read in that session.
outputFormat
The output should be printed to standard output (stdout) as a single line containing 24 space-separated integers. Each integer corresponds to the total number of pages read during the hour starting at that index (i.e., the first integer is for 00:00–00:59, the second for 01:00–01:59, ..., and the twenty-fourth for 23:00–23:59).
## sample3
08:15 08:45 30
10:00 10:30 20
23:10 23:55 15
0 0 0 0 0 0 0 0 30 0 20 0 0 0 0 0 0 0 0 0 0 0 0 15