結果

問題 No.594 壊れた宝物発見機
ユーザー ldsybldsyb
提出日時 2017-11-11 12:34:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,332 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 167,664 KB
実行使用メモリ 43,836 KB
最終ジャッジ日時 2023-09-23 15:44:46
合計ジャッジ時間 8,007 ms
ジャッジサーバーID
(参考情報)
judge15 / 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 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int x = 0, y = 0, z = 0;
	{
		int l = -150, r = 151;
		while (2 < r - l) {
			int a = (l + r) / 3, b = (l + r) / 3 * 2;
			int d1, d2;
			cout << "? " << a << ' ' << y << ' ' << z << endl;
			cin >> d1;
			cout << "? " << b << ' ' << y << ' ' << z << endl;
			cin >> d2;
			assert(0 <= d1 && 0 <= d2);
			if (d1 < d2) {
				r = b;
			} else {
				l = a;
			}
			cerr << "x   " << l << ' ' << r << endl;
		}
		x = l;
	}
	{
		int l = -150, r = 151;
		while (2 < r - l) {
			int a = (l + r) / 3, b = (l + r) / 3 * 2;
			int d1, d2;
			cout << "? " << x << ' ' << a << ' ' << z << endl;
			cin >> d1;
			cout << "? " << x << ' ' << b << ' ' << z << endl;
			cin >> d2;
			assert(0 <= d1 && 0 <= d2);
			if (d1 < d2) {
				r = b;
			} else {
				l = a;
			}
			cerr << "y   " << l << ' ' << r << endl;
		}
		y = l;
	}
	{
		int l = -150, r = 151;
		while (2 < r - l) {
			int a = (l + r) / 3, b = (l + r) / 3 * 2;
			int d1, d2;
			cout << "? " << x << ' ' << y << ' ' << a << endl;
			cin >> d1;
			cout << "? " << x << ' ' << y << ' ' << b << endl;
			cin >> d2;
			assert(0 <= d1 && 0 <= d2);
			if (d1 < d2) {
				r = b;
			} else {
				l = a;
			}
			cerr << "z   " << l << ' ' << r << endl;
		}
		z = l;
	}
	cout << "! " << x << ' ' << y << ' ' << z << endl;
	return 0;
}
0