P17658 [IO 2025 #3] Escape from the Zombie
Background
**This is an interactive problem.**
Description
As everyone knows, zombies live in Nevermore Academy and wander around its grounds. The grounds can be viewed as a Cartesian plane. Zombies are dead creatures, so they are slow and not very bright. They can only move in directions parallel to the coordinate axes, and moving a distance $d$ in one direction takes $d^2$ seconds, where $d$ must be an integer. Note that after each move of distance $d$, the zombie must change its direction of movement, otherwise it will go mad.
For example, the following is a valid zombie path:
$$
(0,0)\to(2,0)\to(2,1)\to(-1,1)\to(-1,-1)\to(0,-1).
$$
The zombie needs $2^2+1^2+3^2+2^2+1^2=19$ seconds to walk this path.
Different routes to the same point may take different amounts of time. Let $f(x,y)$ denote the minimum time a zombie needs to get from $(x,y)$ to $(0,0)$. Unfortunately, the zombie has learned to walk in the minimum time.
You decide to test your wit and your sense of direction. Wednesday knows the zombie's habits very well, and she agrees to play the following game with you.
Wednesday chooses a point with integer coordinates $(x_0,y_0)$ on the plane and places the zombie there. After that, you can ask her queries of the following form:
- `? Δx Δy`: Wednesday moves the zombie along the vector $(\Delta x,\Delta y)$, then tells you how the minimum time changed after the move compared to before it. That is, if the zombie's coordinates before the move were $(x,y)$, she answers $f(x+\Delta x,y+\Delta y)-f(x,y)$. After the query, the zombie stays at its new coordinates.
Of course, Wednesday did not agree to play this game for nothing: you must guess the point she chose, or she will feed you to the zombie.
## Interaction Protocol
The interaction works by your program printing queries and the interactor returning answers. You may perform at most $100$ move operations described above. There is no regular input to read at the start of the program.
To move the point, print a line `? Δx Δy`, where $|\Delta x|,|\Delta y|\le2\cdot10^9$. The interactor will return Wednesday's answer on a separate line.
To report the answer, print a line `! x y`. Here $x,y$ must be the **current coordinates** of the point. Reporting the answer does not count towards the query limit. After that, the interactor will return a verdict: `You win` if the guess is correct, or `Your brains will be eaten` otherwise. If the answer is wrong, your program will receive WA and the interactor will terminate; to avoid getting an incorrect verdict, your program should also terminate immediately after reading a wrong verdict.
It is guaranteed that the point Wednesday initially chose has integer coordinates and $|x_0|,|y_0|\le10^9$.
If the number of queries exceeds $100$, the program will receive WA. If after some move the absolute value of any coordinate of the point exceeds $8\cdot10^9$, the interactor will answer $-1$ and the program will receive WA.
**You must flush the output buffer after printing each line**, otherwise the interactor will not receive your query and the program may receive TL or IL. In C++ you can use `std::cout.flush()`, in Java `System.out.flush()`, and in Python `sys.stdout.flush()`.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first sample, the initially chosen point is $(1,2)$, and after the queries it moves along the following path:
$$
(1,2)\to(3,1)\to(1,1)\to(0,2)\to(1,2).
$$
The minimum times for these positions are $3,6,2,4,3$ respectively, so the answers to the four queries are $3,-4,2,-1$. The final coordinates of the point are $(1,2)$, and the answer reported by the program is correct.
Translated by QwenWork