結果

問題 No.513 宝探し2
ユーザー beetbeet
提出日時 2018-07-27 15:51:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 1,496 ms
コンパイル使用メモリ 163,496 KB
実行使用メモリ 24,252 KB
平均クエリ数 67.42
最終ジャッジ日時 2023-09-24 01:51:58
合計ジャッジ時間 2,999 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,640 KB
testcase_01 AC 28 ms
24,252 KB
testcase_02 AC 27 ms
23,460 KB
testcase_03 AC 27 ms
23,304 KB
testcase_04 AC 27 ms
23,388 KB
testcase_05 AC 27 ms
23,328 KB
testcase_06 AC 28 ms
23,388 KB
testcase_07 AC 29 ms
23,340 KB
testcase_08 AC 26 ms
23,952 KB
testcase_09 AC 27 ms
23,316 KB
testcase_10 AC 28 ms
24,252 KB
testcase_11 AC 28 ms
23,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
Int ask(Int x,Int y){
  cout<<x<<" "<<y<<endl;
  Int d;
  cin>>d;
  if(d==0) exit(0);
  return d;
}
signed main(){
  Int l=-1,r=1e6;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(ask(m,0)<ask(m+1,0)) r=m;
    else l=m;
  }
  Int x=(ask(l,0)<ask(r,0)?l:r);
  l=-1;r=1e6;
  while(l+1<r){
    Int m=(l+r)>>1;
    if(ask(x,m)<ask(x,m+1)) r=m;
    else l=m;
  }
  return 0;
}
0