結果

問題 No.594 壊れた宝物発見機
ユーザー TakatenTakaten
提出日時 2017-11-10 23:13:00
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 1,089 bytes
コンパイル時間 1,473 ms
コンパイル使用メモリ 165,772 KB
実行使用メモリ 24,336 KB
平均クエリ数 62.35
最終ジャッジ日時 2023-09-23 14:51:42
合計ジャッジ時間 5,035 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
23,376 KB
testcase_01 AC 109 ms
23,544 KB
testcase_02 AC 106 ms
23,820 KB
testcase_03 AC 110 ms
23,688 KB
testcase_04 AC 107 ms
23,316 KB
testcase_05 AC 108 ms
23,664 KB
testcase_06 AC 108 ms
23,328 KB
testcase_07 AC 108 ms
24,012 KB
testcase_08 AC 107 ms
23,952 KB
testcase_09 AC 107 ms
23,532 KB
testcase_10 AC 109 ms
24,276 KB
testcase_11 AC 108 ms
23,652 KB
testcase_12 AC 109 ms
23,664 KB
testcase_13 AC 107 ms
23,412 KB
testcase_14 AC 108 ms
24,048 KB
testcase_15 AC 105 ms
24,336 KB
testcase_16 AC 108 ms
23,652 KB
testcase_17 AC 109 ms
23,676 KB
testcase_18 AC 109 ms
23,352 KB
testcase_19 AC 109 ms
23,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 1200000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

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() {
    int a[3] = {0, 0, 0};

    for (int i = 0; i < 3; i++) {
        int l = -150, r = 150;
        while (true) {
            int ans[3];
            int m = (l + r) / 2;
            a[i] = m - 1;
            ans[0] = ask(a[0], a[1], a[2]);
            a[i] = m;
            ans[1] = ask(a[0], a[1], a[2]);
            a[i] = m + 1;
            ans[2] = ask(a[0], a[1], a[2]);

            if (ans[0] > ans[1] && ans[1] < ans[2]) {
                a[i] = m;
                break;
            } else if (ans[0] > ans[1]) {
                l = m + 1;
            } else {
                r = m - 1;
            }
        }
    }

    answer(a[0], a[1], a[2]);

    return 0;
}
0