結果

問題 No.514 宝探し3
ユーザー masamasa
提出日時 2017-05-06 00:19:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 763 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 68,700 KB
実行使用メモリ 24,468 KB
平均クエリ数 5.92
最終ジャッジ日時 2023-09-23 13:53:12
合計ジャッジ時間 3,609 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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