Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0083 - ZOMBDAR |
You are reading data from a zombie sensor. The sensor scans the area to obtain the number of zombies in the immediate area. The zombie sensor normally writes log entries in the form of "Zombies: <integer>;" or "No Zombies;" to its buffer as it performs scans, but it may also write "RUN;" when the sensor is overloaded. These are the only values that will be written to the buffer.
The zombie sensor's serial port emits a line containing whatever data is in its buffer every second, regardless of whether the buffer contains a complete log entry, or even multiple entries.
A valid sequence of log entries may be:
Zombies: 5; Zombies: 1; No Zombies; Zombies: 70; RUN; RUN; RUN;
But the sensor's serial port may emit:
Zom bies: 5;Zombies: 1 ; No Zombies; Zombies 70; RUN; RUN;RUN;Zo
It is imperative to process the serial port data correctly if you are to survive.
Input
The first line of input contains the number of data sets, N (1 <= N <= 50). For each data set, the input contains the raw data emitted by the zombie sensor's serial port (see above for details) followed by a line containing only the string "END OF CASE". Since data is emitted by the zombie sensor's serial port once per second, the first line of input is read after 1 second, the 2nd line after 2 seconds, and so on.
Output
For each complete log entry, you should output a line containing "timestamp: log_entry", where timestamp is the number of seconds elapsed between the start of the data set and the time at which the entry was completely parsed.
Examples
№ |
stdin |
stdout |
1 |
2 Zom bies: 5;Zombies: 1 ; No Zombies; Zombies: 70; RUN; RUN;RUN;RU END OF CASE No Zombies; No Zombies; Zombies: 4;Z ombies : 14; Zombies : 60; Zombies: 100; Zom bies: 15; RUN; RUN;RUN; R END OF CASE |
3: Zombies: 5; 4: Zombies: 1; 5: No Zombies; 6: Zombies: 70; 7: RUN; 8: RUN; 8: RUN; 2: No Zombies; 4: No Zombies; 5: Zombies: 4; 7: Zombies: 14; 9: Zombies: 60; 11: Zombies: 100; 14: Zombies: 15; 15: RUN; 16: RUN; 16: RUN; |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-01-09 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | NA South Central 2013.H |