結果
問題 | No.513 宝探し2 |
ユーザー |
![]() |
提出日時 | 2017-05-05 22:42:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 1,040 bytes |
コンパイル時間 | 1,644 ms |
コンパイル使用メモリ | 165,628 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 67.17 |
最終ジャッジ日時 | 2024-07-17 00:58:03 |
合計ジャッジ時間 | 2,951 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)#define ALL(x) x.begin(),x.end()template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }typedef long long ll;const int MAX = 100000;int main(){int loX = 0,hiX = MAX + 1,loY = 0,hiY = MAX + 1;while(hiX - loX > 1){int mid = (loX + hiX) / 2;int res1,res2;printf("%d %d\n",mid,loY);fflush(stdout);scanf("%d",&res1);printf("%d %d\n",mid - 1,loY);fflush(stdout);scanf("%d",&res2);if(res1 <= res2){loX = mid;}else{hiX = mid;}}while(hiY - loY > 1){int mid = (loY + hiY) / 2;int res1,res2;printf("%d %d\n",loX,mid);fflush(stdout);scanf("%d",&res1);printf("%d %d\n",loX,mid - 1);fflush(stdout);scanf("%d",&res2);if(res1 <= res2){loY = mid;}else{hiY = mid;}}printf("%d %d\n",loX,loY);fflush(stdout);return 0;}