Interactive Reconstruction

아직 제출이 없습니다시간 제한10초메모리 제한1024 MB

문제

This is an interactive task where your program will communicate with a grader through standard input and output. Your task is to reconstruct a labelled tree with $N$ nodes and $N-1$ edges. Nodes are labelled from $1$ to $N$.

Your program is allowed to make a few queries of the following type: Your program should print a string of $N$ characters, consisting only of zeros and ones, one corresponding to each node. The grader will return a sequence of $N$ space-separated integers, the $i$-th representing the sum of the values (i.e. digits of the query string) of all neighbours of the $i$-th node. That is, if node $j$ is a neighbour of node $i$, then the $j$-th digit of the query string counts towards the sum in the $i$-th number of the grader's answer.

See the example below for an illustration.

제한

  • $2 \leq N \leq 3\cdot 10^4$
  • At most $2 \uparrow \uparrow 3 = 2^{(2^2)} = 16$ queries are allowed. The final answer does not count toward this restriction.

힌트

The tree in question is the following one:

1-4-2
  |
  5-3

With the three queries in the example, it is possible to reconstruct it uniquely.