#P6982. [NEERC 2015] Jump
[NEERC 2015] Jump
Description
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 with a bit string of length , and the system will return the number , which is the number of bits that coincide in and at the corresponding positions. The name of the ONEMAX problem comes from the fact that this problem is similar to a simpler one where , so the problem turns into maximizing (MAX) the number of ones (ONE).
When is even, there is a similar (but harder) interactive problem called JUMP. The simplest way to describe 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 that you can see with JUMP are (which means you have 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 judging system tells you the length of the bit string . Then, your solution sends queries, and the system answers them as defined by JUMP. When your solution sends a query such that , the system answers and terminates. Therefore, if your solution tries to read or write anything after reading the answer , it will fail.
The limit on the number of queries is . If your solution sends the -th query, you will get a “Wrong Answer”. You will also get this outcome if your solution terminates too early.
If your query contains invalid characters (neither 0 nor 1), or has an incorrect length (not equal to ), the system will stop the test and you will get a “Presentation Error”.
You may get “Time Limit Exceeded” and other errors for the usual violations.
Finally, if everything is OK (for example, your solution finds the hidden string) on every test, you will get “Accepted”. In that case, you have solved the problem.
Input Format
The first line of the input stream contains an even integer (). The following lines of the input stream contain the answers to the corresponding queries. Each answer is an integer, either , , or . Each answer is on its own line.
Output Format
To make a query, print one line containing a string of length consisting only of the characters 0 and 1. Do not forget to print a newline and flush the output stream after printing your query.
2
1
0
1
2
01
11
10
00
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号