No.594 Broken Treasure Finder
Problem Statement
Koyubi-kun has an excellent treasure finder that shows the coordinates $P(X_t ,Y_t ,Z_t)$ of the treasure and the distance $D_t$ between Koyubi-kun and the treasure.
However, after many uses, it no longer displays the coordinates, and instead of the exact distance $D_t$, it displays a distance $D$ that is not calculated correctly.
Still, $D$ becomes smaller as you get closer and larger as you get farther away, so you can tell whether you are getting closer or farther away.
Using this fact, find the coordinates $P(X_t ,Y_t ,Z_t)$ of the treasure and help Koyubi-kun with his treasure hunt.
The ranges of $X_t,Y_t,Z_t$ are as follows.
$-100\ \le\ X_t\ \le\ 100$ (integer)
$-100\ \le\ Y_t\ \le\ 100$ (integer)
$-100\ \le\ Z_t\ \le\ 100$ (integer)
Distance refers to the Euclidean distance.
Queries
You can make up to 200 queries.(This is the total of question queries and answer queries.)
Question Query
? $X$ $Y$ $Z$$-150\ \le\ X\ \le\ 150$ (integer)
$-150\ \le\ Y\ \le\ 150$ (integer)
$-150\ \le\ Z\ \le\ 150$ (integer)
If you want to obtain the incorrect distance $D$ between the coordinates $Q(X,Y,Z)$ and the treasure's coordinates $P(X_t ,Y_t ,Z_t)$, output in this format.
Output
$D$
$0 \leq D\ <\ 2^{31}$ (integer)
$D$ is the incorrect distance.
Let $D_{i,t}$ be the correct distance between the coordinates of the $i$-th query and the treasure's coordinates, and let $D_i$ be the incorrect distance. Then
when comparing the $a$-th query and the $b$-th query,
it is guaranteed that if $D_{a,t} \leq D_{b,t}$ then $D_a \leq D_b$, and
if $D_{a,t} > D_{b,t}$ then $D_a > D_b$.
If the format of a question query is invalid, $D$ will be $-1$.
Answer Query
! $X$ $Y$ $Z$Once you know the correct coordinates $P(X_t ,Y_t ,Z_t)$ of the treasure, output them as above and terminate the program.
Note that the answer query can be used only once.
Sample Program
#include "bits/stdc++.h"
using namespace std;
// 質問クエリ
int ask(int x, int y, int z) {
int d;
cout << "?" << " " << x << " " << y << " " << z << endl;
cin >> d;
return d;
}
// 回答クエリ
void answer(int x, int y, int z) {
cout << "!" << " " << x << " " << y << " " << z << endl;
}
int main(void) {
int a[3] = {10, 10, 10};
ask(a[0], a[1], a[2]);
answer(a[0], a[1], a[2]);
return 0;
}
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
小指が強い人
りあん