結果
問題 | No.513 宝探し2 |
ユーザー | rika |
提出日時 | 2017-05-05 23:44:22 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 1,526 bytes |
コンパイル時間 | 1,499 ms |
コンパイル使用メモリ | 82,192 KB |
実行使用メモリ | 24,456 KB |
平均クエリ数 | 54.42 |
最終ジャッジ日時 | 2023-09-24 01:08:44 |
合計ジャッジ時間 | 2,100 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
23,364 KB |
testcase_01 | AC | 25 ms
23,688 KB |
testcase_02 | AC | 25 ms
23,364 KB |
testcase_03 | AC | 26 ms
24,084 KB |
testcase_04 | AC | 25 ms
23,436 KB |
testcase_05 | AC | 23 ms
23,556 KB |
testcase_06 | AC | 23 ms
23,604 KB |
testcase_07 | AC | 24 ms
24,456 KB |
testcase_08 | AC | 24 ms
23,844 KB |
testcase_09 | AC | 24 ms
23,652 KB |
testcase_10 | AC | 26 ms
23,520 KB |
testcase_11 | AC | 25 ms
23,400 KB |
ソースコード
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; int main(void) { int i,j; int xlb=0,xub=100000; int ylb=0,yub=100000; rep(i,25){//x int d1,d2,d3; if(xub-xlb==2){ cout<<xlb<<" "<<ylb<<endl; cin>>d1; cout<<xlb+1<<" "<<ylb<<endl; cin>>d2; if(d1<d2)break; xlb++; cout<<xub<<" "<<ylb<<endl; cin>>d3; if(d2>d3)xlb=xub; break; } if(xub-xlb==1){ cout<<xlb<<" "<<ylb<<endl; cin>>d1; cout<<xub<<" "<<ylb<<endl; cin>>d2; if(d1>d2)xlb=xub; break; } int tmp=(xlb+xub)/2; cout<<tmp<<" "<<ylb<<endl; cin>>d1; cout<<tmp+1<<" "<<ylb<<endl; cin>>d2; if(d1<d2)xub=tmp+1; else xlb=tmp; if(xlb>=xub)break; } rep(j,50-i){ int d1,d2; int tmp=(ylb+yub)/2; cout<<xlb<<" "<<tmp<<endl; cin>>d1; if(d1==0)return 0; cout<<xlb<<" "<<tmp+1<<endl; cin>>d2; if(d2==0)return 0; if(d1<d2)yub=tmp+1; else ylb=tmp; } }