#P6982. JUMP Interactive Problem
JUMP Interactive Problem
JUMP Interactive Problem
This is an interactive problem called JUMP based on the toy interactive problem ONEMAX. You are given an even integer \(n\) that denotes the length of a hidden bit-string \(S\). The only allowed operation is to query the system with a bit-string \(Q\) of length \(n\). The system returns a value according to the following rule:
[ \text{JUMP}(Q)= \begin{cases} \text{ONEMAX}(Q) & \text{if } \text{ONEMAX}(Q)=n \text{ or } \text{ONEMAX}(Q)=\frac{n}{2}; \ 0 & \text{otherwise,} \end{cases} ]
Here, \(\text{ONEMAX}(Q)\) is the number of positions where the query \(Q\) matches the hidden string \(S\). In other words:
[ \text{ONEMAX}(Q)=\sum_{i=1}^{n}[Q_i=S_i]. ]
Your objective is to eventually make a query \(Q\) such that \(Q=S\). When you submit a query where \(Q=S\), the system returns \(n\) and terminates the interaction. Note that you are allowed to make at most \(n+500\) queries.
Interaction protocol:
- The system first outputs the integer \(n\) (the length of the bit-string).
- Your solution then makes queries by printing a bit-string \(Q\) of length \(n\).
- For each query, the system responds with either \(n\), \(\frac{n}{2}\), or \(0\) according to the rule above.
- If your query equals the hidden string \(S\), the interaction ends with the system outputting \(n\).
For the purpose of testing in a non-interactive environment, the input will consist of two lines: the first line contains \(n\) and the second line contains the hidden bit-string \(S\). Your program should output the hidden bit-string \(S\).
inputFormat
The input consists of two lines:
- The first line contains an even integer \(n\) ( \(2 \leq n \leq 10^4\) for instance).
- The second line contains a hidden bit-string \(S\) of length \(n\) (each character is either '0' or '1').
outputFormat
Output a single line containing the hidden bit-string \(S\). Your output should exactly match the hidden string.
sample
4
0101
0101
</p>