結果

問題 No.514 宝探し3
ユーザー masamasa
提出日時 2017-05-06 00:19:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 784 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 70,076 KB
実行使用メモリ 35,636 KB
最終ジャッジ日時 2023-09-23 13:52:52
合計ジャッジ時間 7,088 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

const int max_point = 1000000000;

int query(int x, int y) {
	cout << x << " " << y << endl;
	int ret;
	cin >> ret;
	return ret;
}

int main() {
	int n;
	cin >> n;


	int a = query(0, 0);
	if (a == 0) {
		return 0;
	}

	int b = query(max_point, max_point);
	if (b == 0) {
		return 0;
	}

	int add = a + b;
	int sub = a - b;

	int val, x, y;
	for (int i = 0; i < 2; i++) {
		if (i == 0) {
			x = add;
			y = sub;
		} else {
			x = sub;
			y = add;
		}
		x /= add;
		y /= sub;

		if (x < 0 || y < 0) {
			continue;
		}

		for (int j = 0; j < 4; j++) {
			val = query(x + j / 2, y + j % 2);
			if (val == 0) {
				return 0;
			}
		}
	}

	return 0;
}
0