結果

問題 No.513 宝探し2
ユーザー misora192misora192
提出日時 2020-07-24 21:45:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 1,517 ms
コンパイル使用メモリ 164,584 KB
実行使用メモリ 24,324 KB
平均クエリ数 67.25
最終ジャッジ日時 2023-09-24 02:43:15
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,616 KB
testcase_01 AC 25 ms
23,904 KB
testcase_02 AC 25 ms
24,312 KB
testcase_03 AC 25 ms
23,460 KB
testcase_04 AC 26 ms
23,304 KB
testcase_05 AC 24 ms
24,096 KB
testcase_06 AC 24 ms
23,460 KB
testcase_07 AC 26 ms
23,724 KB
testcase_08 AC 24 ms
24,048 KB
testcase_09 AC 25 ms
23,736 KB
testcase_10 AC 26 ms
24,324 KB
testcase_11 AC 25 ms
23,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int lx = -10, rx = 1e6 + 10;
	auto calc = [](int x, int y){
		cout << x << " " << y << endl;
		int d;
		cin >> d;

		if(d == 0) exit(0);
		return d;
	};

	while(rx - lx > 1){
		int mx = (lx + rx) / 2;
		(calc(mx, 0) - calc(mx-1, 0) > 0 ? rx : lx) = mx;
	}

	int ly = -10, ry = 1e6 + 10;
	while(ry - ly > 1){
		int my = (ly + ry) / 2;
		(calc(lx, my) - calc(lx, my-1) > 0 ? ry : ly) = my;
	}

	cout << lx << " " << ly << endl;
}
0