結果

問題 No.513 宝探し2
ユーザー finefine
提出日時 2017-05-05 23:04:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 779 bytes
コンパイル時間 3,206 ms
コンパイル使用メモリ 164,276 KB
実行使用メモリ 24,384 KB
平均クエリ数 57.67
最終ジャッジ日時 2023-09-23 13:30:53
合計ジャッジ時間 4,692 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 27 ms
23,364 KB
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;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int L = 0, R = 100000;
	while (R - L > 2) {
		int M1 = (L * 2 + R) / 3;
		cout << M1 << " " << 0 << endl;
		int v1;
		cin >> v1;
		if (v1 == 0) return 0;
		int M2 = (L + R * 2) / 3;
		cout << M2 << " " << 0 << endl;
		int v2;
		cin >> v2;
		if (v2 == 0) return 0;
		if (v1 > v2) L = M1;
		else R = M2;
	}

	cout << "L " << L << endl;
	cout << "R " << R << endl;

	int vr;
	cout << R << " " << 0 << endl;
	cin >> vr;
	if (vr == 0) return 0;
	int vl;
	cout << L << " " << 0 << endl;
	cin >> vl;
	if (vl == 0) return 0;
	if (vl < vr) cout << L << " " << vl <<  endl;
	else if (vl > vr) cout << R << " " << vr << endl;
	else cout << L + 1 << " " << vl - 1 << endl;

	return 0;
}
0