#P6982. [NEERC 2015] Jump

    ID: 6141 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 6 Uploaded By: Tags>2015交互题Special JudgeICPC

[NEERC 2015] Jump

题目描述

Consider a toy interactive problem ONEMAX which is defined as follows.

You know an integer nn and there is a hidden bit - string SS of length nn. The only thing you may do is to present the system a bit - string QQ of length nn, and the system will return the number ONEMAX(Q)\text{ONEMAX}(Q) — the number of bits which coincide in QQ and SS at the corresponding positions. The name of ONEMAX problem stems from the fact that this problem and a simpler one explaining when S=1111S = 11\ldots11, so that the problem turns into maximization (MAX) of the number of ones (ONE).

When nn 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 nn (which means you've found the hidden string SS) and n/2n/2.

Given an even integer nn — the problem size, you have to solve the JUMP problem for the hidden string SS by making interactive JUMP queries. Your task is to eventually make a query QQ such that Q=SQ = S.

Interaction protocol

First, the testing system tells the length of the bit - string nn. Then, your solution asks the queries and the system answers them as given by the JUMP definition. When a solution asks the query QQ such that Q=SQ = S, the system answers nn and terminates, so if your solution, after reading the answer nn, tries reading or writing anything, it will fail.

The limit on the number of queries is n+500n + 500. If your solution asks a (n+501)(n + 501) - 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 nn), 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 nn (2n10002\leq n\leq1000). The next lines of the input stream consist of the answers to the corresponding queries. Each answer is an integer — either 00, n/2n/2, or nn. Each answer is on its own line.

输出格式

To make a query, print a line which contains a string of length nn which consists of characters 00 and 11 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