結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 27 ms
24,024 KB
testcase_02 AC 27 ms
24,024 KB
testcase_03 WA -
testcase_04 AC 28 ms
23,256 KB
testcase_05 AC 25 ms
24,000 KB
testcase_06 AC 27 ms
23,304 KB
testcase_07 AC 26 ms
23,304 KB
testcase_08 AC 26 ms
23,400 KB
testcase_09 AC 26 ms
23,268 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;
    cout<<mid2<<" "<<0<<endl;
    int d2;cin>>d2;
    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(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;
    cout<<resx<<" "<<mid2<<endl;
    int d2;cin>>d2;
    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(nowmin>d){
      nowmin=d;
      resy=i;
    }
  }
  cout<<resx<<" "<<resy<<"\n";
  return 0;
}
0