結果
問題 | No.513 宝探し2 |
ユーザー | takubokudori |
提出日時 | 2017-09-04 17:46:52 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 1,169 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 87,460 KB |
実行使用メモリ | 24,348 KB |
平均クエリ数 | 41.42 |
最終ジャッジ日時 | 2023-09-24 01:32:19 |
合計ジャッジ時間 | 1,658 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
23,556 KB |
testcase_01 | AC | 21 ms
23,400 KB |
testcase_02 | AC | 23 ms
23,652 KB |
testcase_03 | AC | 22 ms
23,520 KB |
testcase_04 | AC | 19 ms
23,976 KB |
testcase_05 | AC | 21 ms
24,348 KB |
testcase_06 | AC | 20 ms
23,652 KB |
testcase_07 | AC | 20 ms
23,688 KB |
testcase_08 | AC | 23 ms
23,508 KB |
testcase_09 | AC | 21 ms
24,276 KB |
testcase_10 | AC | 23 ms
23,364 KB |
testcase_11 | AC | 22 ms
23,772 KB |
ソースコード
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <valarray> #include <vector> #define N 1000 #define MOD 1000000007 #define pe(str) return cout<<(str)<<endl,0 #define px(str) {cout<<(str)<<endl;exit(0);} #define re(i,n) for(int i=0;i<(n);i++) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define fe(i,n,f) for_each(i,n,f) #define bw(a,b,c) (((a)<=(b))&&((b)<=(c))) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int,int> pii; int rx=30,ry=40; int q(int x,int y){ int a; cout<<x<<" "<<y<<endl; cin>>a; // a=abs(rx-x)+abs(ry-y); // cout<<a<<endl; if(a==0)exit(0); return a; } int main(void){ int a=100000,b=0; int x=100000; int p,r,s; while(a>b){ int m=(a+b)/2; int A=q(x,m); int B=q(x,m+1); int C=q(x,m-1); if(B==C)a=b=m; else if(B>C)a=m-1; else if(B<C)b=m+1; } p=q(0,(a+b)/2); q(p,(a+b)/2); return 0; }