#P11145. 「SFMOI Round I」Strange Homura Game
「SFMOI Round I」Strange Homura Game
Description
This problem is differ from B1. You had better read both statements.
This is an interactive problem.
Hint: We provide a formalized description of this problem at the end of the statement.
Homura and Madoka are playing a game.
Homura has thought of a positive integer , and Madoka need to determine its value.. It is guaranteed that . Also, Homura doesn't cheat, that is, Madoka wouldn't change the value of during the whole game.
Madoka can ask Homura: for a non-negative integer , what is the value of . Madoka aimed to determine the value of with the number of queries as small as possible. (In order to get full points, you need to solve this problem within queries.)
The game will be played for rounds. However, Madoka is at the military training, so she turned to you.
Formally, there exists a hidden positive integer . In each query, a non-negative integer is given, and it returns .
Find with the least number of queries. There are test cases.
The value of is read from input file and won't change according to queries. That is, the interactor is non-adaptive.
Implementation Details
Input a positive integer first, which stands for the number of the rounds.
For each test case:
-
Output a single line containing to make a query. Then, an integer indicating is available.
is a positive integer should be guaranteed, and must fall in .
If instead of the answer, it means that the query limit is excceeded, or the query is invalid. The solution should quit immediately.
-
Output a single line containing to respond to the guess.
After outputting the queries, do not forget to output a newline character and flush the output buffer. Otherwise, you will receive the verdict TLE. To flush the buffer, use:
fflush(stdout)orcout.flush()in C++;flush(output)in Pascal;stdout.flush()in Python;- refer to the documentation for other languages.
Input Format
See [Implementation Details].
Output Format
See [Implementation Details].
1
0
1
? 5
? 1
! 5
Hint
Constraints
It is guaranteed that
- ;
- is a positive ineteger, and 。
Scoring
Let be the maximum queries used in each test. The is calculated as following:
$$\begin{aligned} \mathrm{score}=\begin{cases} 0, & Q\in [101,+\infty) \\ 30, & Q\in [3,101) \\ 50, & Q\in [0,3) \\ \end{cases} \end{aligned}$$The score of the task is the minimum score of each test.
京公网安备 11011102002149号