QOJ.ac

QOJ

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

#22397. Cartellini orari

Statistics

Farmer John vuole migliorare la produttività: le mucche ricevono più fieno se passano più tempo alla mungitrice. Ha introdotto cartellini per $N$ mucche ($1 \le N \le 145$) numerate $1\ldots N$. All'inizio una mucca annota l'ora sul cartellino principale; quando se ne va la annota ancora. FJ ha fortunatamente macchine sufficienti per mungere tutte insieme.

Ogni riga del file ha numero $C$ ($1 \le C \le N$), parola 'START' o 'STOP' e ora in due interi $HH$ e $MM$ separati da uno spazio ($0 \le HH \le 23$; $0 \le MM \le 59$). Le mucche non restano oltre mezzanotte. Il file è completo: ogni START di una mucca ha il relativo STOP più avanti nell'input.

Calcola il tempo totale di ogni mucca alla macchina.

Per esempio, considera un file per due mucche. Contiene il numero di mucche e il totale delle registrazioni $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

La mucca 1 resta 9:00-10:00 e 17:00-17:42, in totale 1 ora 42 minuti (1:42). La mucca 2 resta 9:30-10:15, in totale 45 minuti.

Input

  • Riga 1: due interi separati da uno spazio, $N$ e $Nlines$.
  • Righe $2\ldots Nlines+1$: quattro elementi separati da spazi, $C$, parola chiave, $HH$, $MM$.

Output

  • Righe $1\ldots N$: la riga $i$ contiene due interi separati da uno spazio, ore e minuti del tempo totale della mucca $i$, rispettivamente. I minuti non superano mai 59.

Esempi

Input 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

Output 1

1 42
0 45

Autore del problema: 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.