問題一覧 > 通常問題

No.514 Treasure Hunt 3

レベル : / AI推定難易度 : 525 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : (AC するまで非表示) / 解いたユーザー数 192
作問者 : nmnmnmnmnmnmnm / テスター : Pulmn
お気に入りにしたユーザー ProblemId : 1060 / 自分の提出
問題文最終更新日: 2026-07-01 06:40:32
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 163 (順位表) の他の問題:

Problem Statement

A treasure is buried at coordinates (AX,AY), but you do not know the values of these coordinates.
(AX and AY are both integers between 0 and 1000000000, inclusive.)

By asking about a coordinate, you can learn the Manhattan distance from it to the treasure's position.
Identify the position where the treasure is buried using at most 20 queries.

Input and Output

This problem is a reactive problem.

Output the coordinates (X,Y) you want to query with X and Y separated by a half-width space, in the following form:

X Y

End the output with a newline.
The values of X and Y must be output as integers that fit in a signed 32-bit integer. Also, flush after every output.

After each output, the Manhattan distance between the output position and the treasure's position is given through standard input.
You may ask up to 20 queries, and your answer is accepted when you make an output whose Manhattan distance is 0 and terminate.

Added 2018/02/21 13:13: If 0 is given through standard input, terminate your program without producing any further output. The behavior is undefined if you do not terminate.

Sample Code

// Tries coordinates from (0,0) to (0,19).
int main(){
for(int i=0;i<20;i++){
cout << 0 << " " << i << endl;
int d;
cin>>d;
if(d==0)return 0;
}
return 0;
}

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。