結果

問題 No.594 壊れた宝物発見機
ユーザー t98slidert98slider
提出日時 2022-04-14 07:06:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 877 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 164,528 KB
実行使用メモリ 24,312 KB
平均クエリ数 46.90
最終ジャッジ日時 2023-08-25 19:14:23
合計ジャッジ時間 5,364 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
23,988 KB
testcase_01 AC 96 ms
23,628 KB
testcase_02 AC 98 ms
24,228 KB
testcase_03 AC 100 ms
23,904 KB
testcase_04 AC 99 ms
23,352 KB
testcase_05 AC 100 ms
23,400 KB
testcase_06 AC 94 ms
23,964 KB
testcase_07 AC 94 ms
23,604 KB
testcase_08 AC 93 ms
24,132 KB
testcase_09 AC 94 ms
23,580 KB
testcase_10 AC 96 ms
24,000 KB
testcase_11 AC 94 ms
23,340 KB
testcase_12 AC 92 ms
23,964 KB
testcase_13 AC 93 ms
23,520 KB
testcase_14 AC 94 ms
23,964 KB
testcase_15 AC 94 ms
23,916 KB
testcase_16 AC 99 ms
23,400 KB
testcase_17 AC 91 ms
24,312 KB
testcase_18 AC 95 ms
23,640 KB
testcase_19 AC 91 ms
23,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

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(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int l=-100,r=101,mid,x,y,z;
    auto upd=[&](int a,int b){
        return (a>=0?a/b:(a-b+1)/b);
    };
    while(l<r){
        mid = upd(l+r,2);
        if(ask(mid,0,0)<ask(mid+1,0,0))r=mid;
        else l=mid+1;
    }
    x=l;
    l=-100,r=101;
    while(l<r){
        mid = upd(l+r,2);
        if(ask(x,mid,0)<ask(x,mid+1,0))r=mid;
        else l=mid+1;
    }
    y=l;
    l=-100,r=101;
    while(l<r){
        mid = upd(l+r,2);
        if(ask(x,y,mid)<ask(x,y,mid+1))r=mid;
        else l=mid+1;
    }
    z=l;
    answer(x,y,z);
}
0