|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|2 초 (추가 시간 없음)||1024 MB||3||1||1||33.333%|
Anya is going to be an operator at the laboratory today. The operator's desk has one million switches, no kidding! The switches are numbered by integers from $1$ to $10^6$, and each switch corresponds to a device with the same number. The switches don't show whether the respective devices are on or off, but it is known that toggling a switch changes the state from "on" to "off" and from "off" to "on".
When Anya arrives in the morning, all devices are off. After that, fellow workers come and occasionally toggle the switches.
To optimize energy consumption, after each toggle, the operator has to distinguish between the following classes of states:
Sure enough, Anya will be able to do this. But then she will have to transfer the operator duty to her friend Andrei. And during the transfer, she may only leave a short note to him. After reading the note, Andrei will have the exact same task: fellow workers will toggle the switches, and he will have to know the current class of states of the laboratory.
Help the friends devise a way to write the note so that not only Anya, but also Andrei has all the necessary information after each toggle.
In this problem, your solution will be run twice on each test. In each test, all toggles during both runs are fixed in advance. Each line of input is terminated by an end-of-line character.
During the first run, the solution acts for Anya. The first line contains the word "
start". The second line contains an integer $n$, the number of toggles ($1 \le n \le 100\,000$). Each of the following $n$ lines contains one integer: the number of the device (from $1$ to $10^6$) for which a worker toggled the switch.
For each toggle, print a line with a single integer:
0if all devices are off,
-1if two or more devices are on.
After all the answers, print a single line containing the note Anya will leave to Andrei. The note must have length from $0$ to $1000$ characters and consist only of characters with ASCII codes from $32$ to $126$. There are no other restrictions on the note's contents.
During the second run, the solution acts for Andrei. The first line contains the word "
resume". The second line contains the note, exactly as it was printed during the first run. The third line contains an integer $m$, the number of toggles ($1 \le m \le 100\,000$). Each of the following $m$ lines contains one integer: the number of the device (from $1$ to $10^6$) for which a worker toggled the switch.
For each toggle, print a line with a single integer, following the same rules as during the first run.
For each test, the input during the second run depends on the solution's output during the first run.
Below we show two runs of a certain solution on the first test.
start 5 10 14 10 12 10
10 -1 14 -1 -1 3 10 12 14
resume 3 10 12 14 6 14 277 12 10 277 12
-1 -1 -1 277 0 12