結果

問題 No.513 宝探し2
ユーザー tossytossy
提出日時 2017-05-07 01:19:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,258 bytes
コンパイル時間 1,506 ms
コンパイル使用メモリ 165,216 KB
実行使用メモリ 24,360 KB
平均クエリ数 57.17
最終ジャッジ日時 2023-09-24 01:14:18
合計ジャッジ時間 2,807 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
24,300 KB
testcase_01 AC 27 ms
23,616 KB
testcase_02 AC 28 ms
23,628 KB
testcase_03 AC 27 ms
23,628 KB
testcase_04 AC 28 ms
23,508 KB
testcase_05 AC 26 ms
24,024 KB
testcase_06 AC 27 ms
24,360 KB
testcase_07 AC 26 ms
23,364 KB
testcase_08 AC 27 ms
24,360 KB
testcase_09 AC 26 ms
24,216 KB
testcase_10 AC 27 ms
23,772 KB
testcase_11 AC 27 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int l=0, r=100000;
  while(r-l>2){
    int ml=(r+l*2)/3;
    int mr=(r*2+l)/3;
    int dl,dr;
    cout << 0 << " " << ml << endl;
    cin>>dl;
    cout << 0 << " " << mr << endl;
    cin>>dr;

    if(dl<dr){
      r = mr;
    } else {
      l = ml;
    }
  }

  int dl,dm,dr;
  cout << 0 << " " << l << endl;
  cin>>dl;
  cout << 0 << " " << r << endl;
  cin>>dr;
  cout << 0 << " " << (l+r)/2 << endl;
  cin>>dm;

  if(dl<=dr && dl<=dm){
    cout << dl << " " << l << endl;
  } else if(dm<=dl && dm<=dr){
    cout << dm << " " << (l+r)/2 << endl;
  } else {
    cout << dr << " " << r << endl;
  }

  return 0;
}
0