Snorlax is a very lazy Pokémon. It just eats and sleeps. As its rotund bulk builds, it becomes steadily more slothful. Its stomach can digest any kind of food, even if it happens to be moldy or rotten. It stops eating only to sleep. It doesn’t feel full unless it eats nearly 900 pounds a day.
You are owning a Snorlax at home. As you are not at home that often, you decided to put a Pokémon Sleep device to monitor its well-being. This intellectual device measures Snorlax’s snoring loudness. With a specific constant parameter $K$, we can determine whether snorlax is sleeping or eating. If its snoring loudness is larger or equal to $K$, snorlax is sleeping, and otherwise awake eating.
A piece of data recorded to the device can be described by a 4-digit positive number, where the first 2 digits represent the loudness of Snorlax’s snores, and the last 2 digits represent the duration of the snores.
The thing you have to do now is group every continuous time of Snorlax sleeping or eating, and then lie on Snorlax’s belly falling asleep......
Input Specification
The first line contains an integer $K$. ($1 \le K \le 100$).
The next few lines contain a 4-digit integer, and the input is terminated by 0000.
Output Specification
Output the grouped continuous data.
If Snorlax is sleeping, output [duration] zzZ.
Otherwise, Snorlax is eating, output [duration] !!!.
Subtasks
For every test data, it is garunteed that there are at most $2 \times 10^5$ lines.
Subtask 1: The data alternates within sleeping and eating (40 pts)
Subtask 2: No additional constraints (60 pts)
Sample Test Cases
| Input | Output | |
|---|---|---|
| 10 1210 3020 0918 0523 5512 1019 0628 0000 |
30 zzZ 41 !!! 31 zzZ 28 !!! |
|
In sample case 1, Snorlax sleeps for $10$ units of time with loudness $12$, Snorlax sleeps for $20$ units of time with loudness $30$, Snorlax eats for $18$ units of time with loudness $9$, Snorlax eats for $23$ units of time with loudness $5$, Snorlax sleeps for $12$ units of time with loudness $55$, Snorlax sleeps for $19$ units of time with loudness $10$, Snorlax eats for $28$ units of time with loudness $6$. |
||
Scoring: Per Subtask
Authored by s22l19, s23f32 and wy24215
Appeared in 2026 Mini Comp 1 [WY Interschool Pre-CCC]