QOJ.ac

QOJ

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

#22397. タイムカード

Statistics

Farmer John は生産性を高めたいので、搾乳機で長く過ごす牛に追加の干し草を与えます。計画のため $N$ 頭($1 \le N \le 145$)、番号 $1\ldots N$ にタイムカードを導入しました。牛は使い始めると開始時刻を共通カードに書き、離れるときも時刻を書きます。幸い FJ には全頭同時に搾乳できるだけの機械があります。

記録はファイルに入力され、各行は牛番号 $C$($1 \le C \le N$)、キーワード('START' か 'STOP')、空白区切りの 2 整数 $HH$ と $MM$($0 \le HH \le 23$;$0 \le MM \le 59$)の時刻です。牛は真夜中を越えて機械にいません。ファイルは完全で、各牛の START に対応する STOP が入力の後にあります。

各牛が搾乳機で過ごす総時間を計算してください。

例として 2 頭のファイルを考えます。牛数だけでなく記録総数 $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:空白区切りの 2 整数 $N$ と $Nlines$。
  • 行 $2\ldots Nlines+1$:各行は空白区切りの四つの項目 $C$、キーワード、$HH$、$MM$。

出力

  • 行 $1\ldots N$:行 $i$ は牛 $i$ の総時間の時間数、分数の順に空白区切りの 2 整数です。分は当然 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.