Minus Operator

시간 제한2초메모리 제한2048 MB

문제

The minus operator on binary values $a$ and $b$ is defined by $(a − b) = 1$ if $a = 1$ and $b = 0$; otherwise, $(a − b) = 0$. Also, the syntax of an expression is defined as follows. Here, x, parentheses, and the minus are terminal symbols, and $E$ is the start symbol.

$E ::= $x$ | (E − E)$

The judge program possesses an expression adhering to $E$. The expression is hidden from you. At the start, you are only provided with the number of terminal symbols x in the expression, denoted by $n$.

Your task is to guess the expression by making a limited number of queries.

In a single query, you specify a binary string $S$ of length $n$. The judge program then temporarily replaces each occurrence of the $i$-th terminal symbol x from the left with $S_i$, for $i = 1, \dots , n$, and evaluates the replaced expression based on the definition of the minus operator. After that, the judge program returns the evaluated value to you, which is either $0$ or $1$.