#P6982. [NEERC 2015] Jump
[NEERC 2015] Jump
题目描述
Consider a toy interactive problem ONEMAX which is defined as follows.
You know an integer and there is a hidden bit - string of length . The only thing you may do is to present the system a bit - string of length , and the system will return the number — the number of bits which coincide in and at the corresponding positions. The name of ONEMAX problem stems from the fact that this problem and a simpler one explaining when , so that the problem turns into maximization (MAX) of the number of ones (ONE).
When is even, there is a similar (but harder) interactive problem called JUMP. The simplest way to describe the JUMP is by using ONEMAX:
$$\text{JUMP}(Q)= \begin{cases} \text{ONEMAX}(Q) & \text{if } \text{ONEMAX}(Q)=n \text{ or } \text{ONEMAX}(Q)=n/2; \\ 0 & \text{otherwise.} \end{cases} $$Basically, the only nonzero values of ONEMAX which you can see with JUMP are (which means you've found the hidden string ) and .
Given an even integer — the problem size, you have to solve the JUMP problem for the hidden string by making interactive JUMP queries. Your task is to eventually make a query such that .
Interaction protocol
First, the testing system tells the length of the bit - string . Then, your solution asks the queries and the system answers them as given by the JUMP definition. When a solution asks the query such that , the system answers and terminates, so if your solution, after reading the answer , tries reading or writing anything, it will fail.
The limit on the number of queries is . If your solution asks a - th query, then you will receive the “Wrong Answer” outcome. You will also receive this outcome if your solution terminates too early.
If your query contains wrong characters (neither 0, nor 1), or has a wrong length (not equal to ), the system will terminate the testing and you will receive the “Presentation Error” outcome.
You will receive the “Time Limit Exceeded” outcome and other errors for the usual violations.
Finally, if everything is OK (e.g. your solution finds the hidden string) on every test, you will receive the “Accepted” outcome, in this case you will have solved the problem.
输入格式
The first line of the input stream contains an even number (). The next lines of the input stream consist of the answers to the corresponding queries. Each answer is an integer — either , , or . Each answer is on its own line.
输出格式
To make a query, print a line which contains a string of length which consists of characters and only. Don't forget to put a newline character and to flush the output stream after you print your query.
2
1
0
1
2
01
11
10
00