#abc299d. [abc299_d]Find by Query
[abc299_d]Find by Query
Problem Statement
This is an interactive task, where your program and the judge interact via Standard Input and Output.
The judge has a string of length consisting of and : . Here, and .
You are given the length of , but not the contents of . Instead, you can ask the judge at most questions as follows.
- Choose an integer such that and ask the value of .
Print an integer such that and .
It can be shown that such always exists under the settings of this problem.
Constraints
Input and Output
First, receive the length of the string from Standard Input:
Then, you get to ask the judge at most questions as described in the problem statement.
Print each question to Standard Output in the following format, where is an integer satisfying :
?
In response to this, the value of will be given from Standard Input in the following format:
Here, is or .
When you find an integer satisfying the condition in the problem statement, print it in the following format, and immediately quit the program:
!
If multiple solutions exist, you may print any of them.
Notes
- Print a newline and flush Standard Output at the end of each message. Otherwise, you may get a TLE