結果
問題 | No.594 壊れた宝物発見機 |
ユーザー |
|
提出日時 | 2022-04-14 07:06:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 877 bytes |
コンパイル時間 | 1,692 ms |
コンパイル使用メモリ | 166,540 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 46.90 |
最終ジャッジ日時 | 2024-12-24 05:14:15 |
合計ジャッジ時間 | 6,024 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#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); }