Logo
(追記) (追記ここまで)

16863번 - Score! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB95454251.220%

문제

Kathy is in charge of statistics for the girl’s basketball team at her high school. She meticulously records each basket made and the time it occurred. Her record book for a game might begin as follows:

H 2 0:13
A 2 0:19
H 1 0:52
H 1 0:52
A 3 1:08
...

This indicates that

  • the home team (H) scored a 2-point basket 13 seconds into the game
  • the away team (A) scored a 2-point basket 6 seconds later
  • the home team made two free throws (each worth 1 point) 52 seconds into the game (recall that the clock stops when a free throw is made)
  • the away team made a three point basket 1 minute and 8 seconds into the game.

The coach is very impressed with all the statistics that Kathy keeps. Using these statistics, he would like to know how long each team was in the lead during the game. For example, if both teams went into an incredible shooting slump after the 1:08 mark in the game and no more baskets were made until the end of the game (32 minutes for a high school game) then the home team would have led for 22 seconds (from 0:13 to 0:19 and from 0:52 to 1:08) and the away team would have led for 30:52 (from 1:08 to 32:00).

Kathy is very proud of how impressed the coach is, but she’s not looking forward to going through each game record to determine how long each team was in the lead. Can you help her?

입력

Input starts with a positive integer n indicating the number of scores in the game. Following this are n lines of the form T p time where T is either ’H’ or ’A’, p is the number of points scored (either 1, 2 or 3) and time is the time the points were scored in either the form m:ss (if the time is less than 10 minutes) or mm:ss. All times are between 0:00 and 31:59 and given in non-decreasing order.

출력

Display three things: 1) either an ’H’ or ’A’ indicating which team won the game, 2) the length of time the home team was leading, and 3) the length of time the away team was leading. Use the form m:ss for any time less than 10 minutes and mm:ss otherwise. All games will have a winner.

제한

예제 입력 1

5
H 2 0:13
A 2 0:19
H 1 0:52
H 1 0:52
A 3 1:08

예제 출력 1

A 0:22 30:52

예제 입력 2

1
H 1 16:00

예제 출력 2

H 16:00 0:00

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2018 East Central Regional Contest 연습 세션 PD번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /