結果

問題 No.514 宝探し3
ユーザー rikarika
提出日時 2017-05-05 23:46:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,534 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 83,108 KB
実行使用メモリ 107,372 KB
平均クエリ数 52.00
最終ジャッジ日時 2023-09-23 13:51:05
合計ジャッジ時間 3,388 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 22 ms
23,832 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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=1000000000;
  int ylb=0,yub=1000000000;
  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;
  }

}
0