No.1429 Simple Dowsing
Problem Statement
Runrun received a marshmallow detector for White Day.
There is a plot of land $100$ meters on each side, and $1$ golden marshmallow is buried beneath it.
Let the coordinates of the southwest, southeast, northwest, and northeast corners of this land be $(0, 0), (100, 0), (0, 100), (100, 100)$ respectively.
If the coordinates of the golden marshmallow are $(a, b)$, it is known that $a, b$ are both integers between $0$ and $100$, inclusive.
(Since the golden marshmallow is small, it seems that it may be buried on the boundary of the land.)
The marshmallow detector is used as follows.
- Stand at a point $(p, q)$ on the land such that $p, q$ are both integers, and press the button. ($0 \leq p, q \leq 100$ must hold.)
- Then, an integer $d$ is displayed on the detector's screen. This represents the square of the (Euclidean) distance from $(p, q)$ to the position $(a, b)$ of the golden marshmallow.
- However, the detector explodes when the button is pressed $3$ times, so the button must be pressed at most $2$ times.
Send Runrun instructions for using the detector and for digging, and let Runrun obtain the golden marshmallow with a single dig.
Input and Output
Send detector usage instructions and digging instructions to standard output as described below. If you do not follow these descriptions, the judge result is undefined.
-
Detector usage instruction:
? $p$ $q$
This means standing at the point $(p, q)$ and pressing the detector's button. Here, $p, q$ must each be integers between $0$ and $100$, inclusive.
The integer $d$ ($= (p - a)^2 + (q - b)^2$) displayed on the detector's screen is sent to standard input as follows.$d$
You must not send detector usage instructions $3$ or more times.
-
Digging instruction:
! $r$ $s$
This means digging at the point $(r, s)$. Here, output $r, s$ each as an integer. The answer is judged correct if $(r, s) = (a, b)$.
Send the digging instruction exactly $1$ time, and terminate the program immediately afterward.
Notes:
- End each instruction with a newline, and flush standard output each time you send an instruction. Otherwise, the judge result is undefined.
- If you produce output that does not match the format of either of the two types of instructions above, the judge result is also undefined.
-
"The judge result is undefined" means that any result is possible.
(For example, if the program terminates without sending a digging instruction, the result may be Query Limit Exceeded.)
Sample
Sample 1
Input
5 0
Output
? 3 6 ? 2 8 ! 2 8
This is an example of the interaction when the golden marshmallow is buried at the point $(2, 8)$. The instructions sent to Runrun are as follows.
- Stand at the point $(3, 6)$ and press the detector's button. (The screen displayed $5$ ($= (3 - 2)^2 + (6 - 8)^2$).)
- Stand at the point $(2, 8)$ and press the detector's button. (The screen displayed $0$ ($= (2 - 2)^2 + (8 - 8)^2$).)
- Dig at the point $(2, 8)$. (Luckily, the golden marshmallow was obtained with a single dig.)
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
evima
mine691