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', וזמן כשני שלמים $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, בסך הכול שעה ו־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.