You have moved to a new city, called Bytetown.
The citizens of Bytetown get around by using one central rail line.
This rail line is straight, and positions on it are numbered from
However, you don't know where the stations are, and your friend, who has been living in Bytetown for a long time, is not willing to tell you.
Instead, he allows you to make queries of the form "what is the minimum amount of distance one needs to walk to go from position
Constraints
Subtask 1 [15%]
Subtask 2 [85%]
No additional constraints.
Interaction
This is an interactive problem.
The first line contains three integers
After that, you can make a query by outputting ? a b
, where
The grader will respond with a single integer representing the minimum amount of distance one needs to walk to go from position -1
if you made an invalid query or exceeded the query limit.
You should terminate your program immediately after receiving a -1
response to receive the correct verdict.
You should output ! p_1 p_2 p_3 ... p_n
once you believe you have determined the positions of the stations, where
You should flush the output stream after every query. This can be done with fflush(stdout);
or std::cout << std::flush;
in C++, System.out.flush();
in Java, or sys.stdout.flush()
in Python.
You will receive a verdict of Presentation Error
if your output has incorrectly formatted queries (the wrong number of tokens, incorrect whitespace, no !
type query, etc.) and Wrong Answer
if you exceed the query limit, guess the positions incorrectly, or output integers outside the specified ranges.
After outputting -1
, the grader will not respond to any further queries, and therefore you should terminate your program to avoid receiving a Time Limit Exceeded
verdict.
Sample Interaction
>>>
denotes your output. Do not print this out.
The positions of the stations are
3 10 32768
>>> ? 1 6
2
>>> ? 0 5
0
>>> ? 3 4
1
>>> ? 5 10
5
>>> ! 5 0 2
Comments