Minus Operator
시간 제한2초메모리 제한2048 MB
E ::= x | (E - E) 형태의 숨겨진 이진 수식을 추측한다. n개의 잎에 비트를 대입하는 질의를 하면 마이너스 연산으로 계산한 값 0 또는 1을 돌려받는다.
문제
The minus operator on binary values and is defined by if and ; otherwise, . Also, the syntax of an expression is defined as follows. Here, x, parentheses, and the minus are terminal symbols, and is the start symbol.
x
The judge program possesses an expression adhering to . 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 .
Your task is to guess the expression by making a limited number of queries.
In a single query, you specify a binary string of length . The judge program then temporarily replaces each occurrence of the -th terminal symbol x from the left with , for , 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 or .