結果

問題 No.513 宝探し2
ユーザー utouto97utouto97
提出日時 2019-02-09 15:40:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,127 bytes
コンパイル時間 1,049 ms
コンパイル使用メモリ 144,620 KB
実行使用メモリ 24,288 KB
平均クエリ数 81.00
最終ジャッジ日時 2023-09-23 16:47:38
合計ジャッジ時間 4,397 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

int main()
{
  int x, y;

  int l = 0, r = 100000;
  rep(i, 20){
    int x1 = (l+l+r)/3;
    int x2 = (l+r+r)/3;
    int y1, y2;

    cout << x1 << " " << 0 << endl;
    cin >> y1;
    cout << x2 << " " << 0 << endl;
    cin >> y2;

    if(y1 < y2) l = x1;
    else r = x2;
  }

  x = l;

  l = 0, r = 100000;
  rep(i, 20){
    int x1 = (l+l+r)/3;
    int x2 = (l+r+r)/3;
    int y1, y2;

    cout << x << " " << x1 << endl;
    cin >> y1;
    cout << x << " " << x2 << endl;
    cin >> y2;

    if(y1 < y2) l = x1;
    else r = x2;
  }

  cout << x << " " << l << endl;

  return 0;
}
0