QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22397. 시간 카드

Statistics

Farmer John은 생산성을 높이려 하여 소가 착유기에서 더 오래 지내면 건초를 추가로 줍니다. 이를 위해 $1\ldots N$으로 번호를 붙인 $N$마리 소($1 \le N \le 145$)에게 시간 카드를 도입했습니다. 소는 시작할 때 공통 카드에 시작 시각을 적고 떠날 때도 시각을 적습니다. 다행히 FJ는 모든 소를 동시에 착유할 만큼 기계가 있습니다.

파일 각 줄에는 소 번호 $C$($1 \le C \le N$), 키워드 'START' 또는 'STOP', 공백으로 구분한 두 정수 $HH$, $MM$($0 \le HH \le 23$; $0 \le MM \le 59$)으로 표현한 시간이 있습니다. 소는 자정을 넘어 머무르지 않습니다. 파일은 완전하여 각 소의 모든 START 뒤에는 대응하는 STOP이 입력 파일의 뒤쪽에 있습니다.

각 소가 착유기에서 지낸 총 시간을 계산하세요.

예를 들어 두 소의 파일을 봅니다. 소 수뿐 아니라 시간 기록 총수 $Nlines$($1 \le Nlines \le 1,458$)도 포함합니다.

2 6
1 START 9 0
2 START 9 30
1 STOP 10 0
2 STOP 10 15
1 START 17 0
1 STOP 17 42

소 1은 9:00-10:00과 17:00-17:42에 있어 총 1시간 42분(1:42)입니다. 소 2는 9:30-10:15에 있어 총 45분입니다.

입력

  • 줄 1: 공백으로 구분한 두 정수 $N$과 $Nlines$입니다.
  • 줄 $2\ldots Nlines+1$: 공백으로 구분한 네 항목 $C$, 키워드, $HH$, $MM$입니다.

출력

  • 줄 $1\ldots N$: 줄 $i$에는 소 $i$가 지낸 총 시간의 시간 수와 분 수인 두 정수가 순서대로 공백으로 구분되어 있습니다. 분은 59를 넘지 않습니다.

예제

입력 1

2 6
1 START 9 0
2 START 9 30
1 STOP 10 0
2 STOP 10 15
1 START 17 0
1 STOP 17 42

출력 1

1 42
0 45

문제 출제: Rob Kolstad, 2009

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.