結果

問題 No.513 宝探し2
ユーザー misora192misora192
提出日時 2020-07-24 21:36:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 1,521 ms
コンパイル使用メモリ 164,764 KB
実行使用メモリ 36,140 KB
最終ジャッジ日時 2023-09-24 03:56:33
合計ジャッジ時間 8,250 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
		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