結果

問題 No.513 宝探し2
ユーザー face4face4
提出日時 2018-06-01 22:49:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 63,024 KB
実行使用メモリ 24,276 KB
平均クエリ数 2.75
最終ジャッジ日時 2023-09-24 01:47:49
合計ジャッジ時間 1,816 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,628 KB
testcase_01 AC 25 ms
24,000 KB
testcase_02 AC 24 ms
24,048 KB
testcase_03 AC 24 ms
24,192 KB
testcase_04 AC 25 ms
23,376 KB
testcase_05 AC 25 ms
23,364 KB
testcase_06 AC 24 ms
24,072 KB
testcase_07 AC 24 ms
23,616 KB
testcase_08 AC 25 ms
24,180 KB
testcase_09 AC 24 ms
24,240 KB
testcase_10 AC 25 ms
24,276 KB
testcase_11 AC 25 ms
24,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 解説を見て感動した
#include<iostream>

using namespace std;

int query(int x, int y){
    cout << x << " " << y << endl << flush;
    cin >> x;
    if(x == 0)  exit(0);

    return x;
}

int main(){
    int a = query(0,0);             // a = X + Y
    int b = query(0,100000);        // b = X + 100000 - Y
    int x = (a+b-100000)/2;         // x = (X+Y+X+Y-100000)/2
    int y = a-x;
    query(x,y);
    return 0;
}
0