COCI '10 Contest 5 #2 Košarka

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 32M

Problem types

Slavko has started to follow the NBA league. The game duration is exactly 4848 minutes. When a game ends, the statistics are shown. Slavko has written down whenever a team scored. He is curious about how long each team was in the lead.

Input Specification

The first line of input contains one integer NN (1 \leq N \leq 100)(1 \leq N \leq 100). The following NN lines describe events when a team scored.

Each description consists of a team that scored, which is either 11 or 22, and a timestamp in format MMMM:SSSS (minutes:seconds), the time when a team scored. Minutes and seconds are zero padded and from ranges [00, 47][00, 47] and [00, 59][00, 59] (inclusive). The given timestamps are unique.

Output Specification

The first line of output must contain the duration that the first team was in the lead.

The second line of output must contain the duration that the second team was in the lead.

All durations should be in MMMM:SSSS format, with leading zeros.

Sample Input 1

1
1 20:00

Sample Output 1

28:00
00:00

Sample Input 2

3
1 01:10
2 21:10
2 31:30

Sample Output 2

20:00
16:30

Sample Input 3

5
1 01:10
1 02:20
2 45:30
2 46:40
2 47:50

Sample Output 3

45:30
00:10

Comments

There are no comments at the moment.