問題一覧 > 通常問題

No.594 Broken Treasure Finder

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : (AC するまで非表示) / 解いたユーザー数 131
作問者 : 小指が強い人 / テスター : りあん
お気に入りにしたユーザー ProblemId : 1181 / 自分の提出
問題文最終更新日: 2026-06-25 11:09:45
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 177 (順位表) の他の問題:

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.

Notes

This problem is reactive.
For notes, please refer to " What is a reactive problem? ".

Queries

You can make up to 200 queries.

(This is the total of question queries and answer queries.)
Question Query
Input
? $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
Input
! $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もしくは右上の雲マークをクリックしてアカウントを作成してください。