P29670 [洛谷] [COCI2010-2011#5] KOŠARKA
普及
题目描述

Problem Description

Slavko has started following the NBA. The duration of a game is exactly 48 minutes. After a game, statistical data is displayed. Whenever a team scores, Slavko records it. He is curious about the duration each team leads.

Input Format

The input consists of \( N \) lines:

  • The first line contains an integer \( N \), indicating the number of events.
  • The next \( N \) lines describe when a team scores:
  • Each description includes the team that scored (1 or 2) and the time of the score in the format \( MM:SS \). If the minutes or seconds are \(\le 9\), they are padded with a leading zero.

Output Format

  • The first line of the output is the duration the first team was in the lead.
  • The second line is the duration the second team was in the lead.
  • All durations should be in the format \( MM:SS \), including leading zeros.

Sample Input and Output

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

Notes

[Sample Explanation #1]

Team 1 scores at exactly 20 minutes, leading 1:0. For the next 28 minutes, Team 2 does not score, so Team 1 remains in the lead.

[Data Range]

For 100% of the data, \( 1 \le N \le 100 \), \( 0 \le \) minutes \( \le 47 \), \( 0 \le \) seconds \( \le 59 \).

[Explanation]

This problem's score is set according to the original COCI contest, with a maximum score of 50.

The problem is translated from COCI2010-2011 CONTEST #5 T2 KOŠARKA.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 1 20:00
样例输出
28:00 00:00