結果

問題 No.594 壊れた宝物発見機
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-08-25 01:30:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,547 bytes
コンパイル時間 1,505 ms
コンパイル使用メモリ 165,968 KB
実行使用メモリ 24,240 KB
平均クエリ数 70.50
最終ジャッジ日時 2023-09-23 18:02:57
合計ジャッジ時間 5,012 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
24,192 KB
testcase_01 AC 105 ms
23,580 KB
testcase_02 AC 108 ms
23,964 KB
testcase_03 AC 105 ms
24,120 KB
testcase_04 AC 107 ms
24,240 KB
testcase_05 AC 107 ms
23,460 KB
testcase_06 WA -
testcase_07 AC 104 ms
23,328 KB
testcase_08 AC 107 ms
23,952 KB
testcase_09 AC 105 ms
23,796 KB
testcase_10 AC 106 ms
23,580 KB
testcase_11 AC 106 ms
23,316 KB
testcase_12 AC 105 ms
23,472 KB
testcase_13 AC 107 ms
23,376 KB
testcase_14 AC 106 ms
23,580 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = MOD - 1;
const ll LLINF = 4e18;

// 質問クエリ
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 x, y, z;
    int l, r;
    l = -100, r = 100;
    while (r - l > 2) {
        int m1 = (2 * l + r) / 3;
        int m2 = (l + 2 * r) / 3;
        if (ask(m1, 0, 0) <= ask(m2, 0, 0)) {
            r = m2;
        }
        else {
            l = m1;
        }
    }
    x = (l + r) / 2;
    l = -100, r = 100;
    while (r - l > 2) {
        int m1 = (2 * l + r) / 3;
        int m2 = (l + 2 * r) / 3;
        if (ask(0, m1, 0) <= ask(0, m2, 0)) {
            r = m2;
        }
        else {
            l = m1;
        }
    }
    y = (l + r) / 2;
    l = -100, r = 100;
    while (r - l > 2) {
        int m1 = (2 * l + r) / 3;
        int m2 = (l + 2 * r) / 3;
        if (ask(0, 0, m1) <= ask(0, 0, m2)) {
            r = m2;
        }
        else {
            l = m1;
        }
    }
    z = (l + r) / 2;
    answer(x, y, z);
    getchar(); getchar();
}
0