結果

問題 No.513 宝探し2
ユーザー aim_cpoaim_cpo
提出日時 2018-02-26 00:55:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 1,374 ms
コンパイル使用メモリ 165,760 KB
実行使用メモリ 24,372 KB
平均クエリ数 90.92
最終ジャッジ日時 2023-09-23 15:50:37
合計ジャッジ時間 3,361 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  int minx=0,maxx=100000;
  int miny=0,maxy=100000;
  while(abs(minx-maxx)>3){
    int mid1=(maxx+2*minx)/3;
    int mid2=(minx+2*maxx)/3;
    cout<<mid1<<" "<<0<<endl;
    int d;cin>>d;
    if(d==0)return 0;
    cout<<mid2<<" "<<0<<endl;
    int d2;cin>>d2;
    if(d2==0)return 0;
    if(d2>=d){
      maxx=mid2;
    }else{
      minx=mid1;
    }
  }
  int nowmin=999999999;
  int resx=minx;
  for(int i=minx;i<=maxx;i++){
    cout<<i<<" "<<0<<"\n";
    int d;cin>>d;
    if(d==0)return 0;
    if(nowmin>d){
      nowmin=d;
      resx=i;
    }
  }
  while(abs(miny-maxy)>3){
    int mid1=(maxy+2*miny)/3;
    int mid2=(miny+2*maxy)/3;
    cout<<resx<<" "<<mid1<<endl;
    int d;cin>>d;
    if(d==0)return 0;
    cout<<resx<<" "<<mid2<<endl;
    int d2;cin>>d2;
    if(d2==0)return 0;
    if(d2>=d){
      maxy=mid2;
    }else{
      miny=mid1;
    }
  }
  int resy=miny;
  nowmin=999999999;
  for(int i=miny;i<=maxy;i++){
    cout<<resx<<" "<<i<<"\n";
    int d;cin>>d;
    if(d==0)return 0;
    if(nowmin>d){
      nowmin=d;
      resy=i;
    }
  }
  cout<<resx<<" "<<resy<<"\n";
  return 0;
}
0