結果

問題 No.594 壊れた宝物発見機
コンテスト
ユーザー t98slider
提出日時 2022-04-14 07:06:03
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 877 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,443 ms
コンパイル使用メモリ 180,072 KB
実行使用メモリ 30,052 KB
平均クエリ数 46.90
最終ジャッジ日時 2026-05-30 01:23:56
合計ジャッジ時間 4,386 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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