結果
問題 | No.513 宝探し2 |
ユーザー |
![]() |
提出日時 | 2024-09-30 00:48:53 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,051 bytes |
コンパイル時間 | 921 ms |
コンパイル使用メモリ | 92,376 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 95.75 |
最終ジャッジ日時 | 2024-09-30 00:48:57 |
合計ジャッジ時間 | 3,159 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 8 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>using namespace std;using ll = long long;ll ask(ll x,ll y){cout<<x<<" "<<y<<endl;ll d;cin>>d;if(d==0){exit(0);}return d;}int main(){cin.tie(nullptr);ios::sync_with_stdio(false);ll left = 0;ll right = 100000;while(right-left>2){ll m1 = (left+left+right) / 3;ll m2 = (right+right+left) / 3;ll d1 = ask(m1,0);ll d2 = ask(m2,0);if(d1<=d2) right = m2;else left = m1;}ll use;ll mn = 1e9;for(ll x = left;x<=right;x++){ll d = ask(x,0);if(d<mn){mn = d;use = x;}}ll x = mn;left = 0;right = 100000;while(right-left>2){ll m1 = (left+left+right) / 3;ll m2 = (right+right+left) / 3;ll d1 = ask(x,m1);ll d2 = ask(x,m2);if(d1<=d2) right = m2;else left = m1;}for(ll x = left;x<=right;x++){ll d = ask(x,0);}}