結果

問題 No.594 壊れた宝物発見機
ユーザー tottoripapertottoripaper
提出日時 2017-11-10 22:40:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 1,380 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 165,036 KB
実行使用メモリ 24,420 KB
平均クエリ数 82.00
最終ジャッジ日時 2023-09-23 14:46:54
合計ジャッジ時間 4,875 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
23,316 KB
testcase_01 AC 102 ms
23,772 KB
testcase_02 AC 104 ms
24,300 KB
testcase_03 AC 100 ms
24,420 KB
testcase_04 AC 98 ms
23,580 KB
testcase_05 AC 103 ms
23,340 KB
testcase_06 AC 102 ms
24,360 KB
testcase_07 AC 103 ms
24,252 KB
testcase_08 AC 100 ms
24,192 KB
testcase_09 AC 99 ms
23,364 KB
testcase_10 AC 102 ms
23,436 KB
testcase_11 AC 101 ms
23,580 KB
testcase_12 AC 102 ms
23,568 KB
testcase_13 AC 103 ms
24,192 KB
testcase_14 AC 101 ms
23,568 KB
testcase_15 AC 100 ms
23,448 KB
testcase_16 AC 100 ms
24,072 KB
testcase_17 AC 100 ms
24,060 KB
testcase_18 AC 102 ms
23,364 KB
testcase_19 AC 99 ms
23,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int ask(int x, int y, int z) {
	int d;
	cout << "?" << " " << x << " " << y << " " << z << endl;
    // d = abs(x) + abs(y) + abs(z) + 80;
	cin >> d;
	return d;
}

void answer(int x, int y, int z) {
	cout << "!" << " " << x << " " << y << " " << z << endl;
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    int x[3] = {0, 0, 0};

    for(int i=0;i<3;++i){
        int lb = -150, ub = 151;

        while(ub - lb > 2){
            int m1 = (2 * lb + ub) / 3,
                m2 = (lb + 2 * ub) / 3;

            x[i] = m1;
            int d1 = ask(x[0], x[1], x[2]);
            x[i] = m2;
            int d2 = ask(x[0], x[1], x[2]);

            if(d1 < d2){
                ub = m2;
            }else{
                lb = m1;
            }
        }

        x[i] = lb;
        int d1 = ask(x[0], x[1], x[2]);
        x[i] = lb + 1;
        int d2 = ask(x[0], x[1], x[2]);

        if(d1 < d2){
            x[i] = lb;
        }else{
            x[i] = lb + 1;
        }
    }

    answer(x[0], x[1], x[2]);
}
0