問題一覧 > 通常問題

No.513 宝探し2

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : (AC するまで非表示) / 解いたユーザー数 220
作問者 : nmnmnmnmnmnmnm / テスター : Pulmn
お気に入りにしたユーザー ProblemId : 1059 / 自分の提出
問題文最終更新日: 2026-07-02 11:35:24
Treasure Hunt 2
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. Show the original
yukicoder contest 163 (順位表) の他の問題:

Problem Statement

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

By querying a coordinate, you can learn the Manhattan distance from it to the position of the treasure.
Determine the position where the treasure is buried using at most 100 queries.

Input and Output

This problem is a reactive problem.

Output the coordinates (X,Y) to query in the form

X Y

with X and Y separated by a single-byte space. Print a newline at the end.
The values of X and Y must be integers that fit in a signed 32-bit integer. Also, flush after every output.

After each output, the Manhattan distance from the output position to the position of the treasure is given via standard input.
You may make up to 100 queries, and your answer is judged correct when you have made an output whose Manhattan distance is 0 and terminated.

Added 2018/02/21 13:13: If 0 is given via standard input, terminate your program without any further output. The behavior is undefined if it does not terminate.

Sample Code

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

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