結果

問題 No.594 壊れた宝物発見機
ユーザー 小指が強い人小指が強い人
提出日時 2016-06-08 22:04:51
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 5,026 ms
コンパイル使用メモリ 144,944 KB
実行使用メモリ 24,408 KB
平均クエリ数 61.00
最終ジャッジ日時 2023-09-23 10:51:54
合計ジャッジ時間 4,998 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int ask(int x, int y, int z) {
	cout << "?" << " " << x << " " << y << " " << z << " " << 10 << endl;
	int v;
	cin >> v;
	return v;
}

string answer(int x, int y, int z) {
	cout << "!" << " " << x << " " << y << " " << z << endl;
	string str;
	cin >> str;
	return str;
}

int search(int a[3], int i, int left, int right) {
	int b[3] = {a[0], a[1], a[2]};
	while(left < right - 2) {
		int dist = right - left;
		b[i] = dist / 3 + left;
		int v1 = ask(b[0], b[1], b[2]);
		b[i] = dist * 2 / 3 + left;
		int v2 = ask(b[0], b[1], b[2]);
		if(v1 <= v2)
			right = dist * 2 / 3 + left;
		else
			left = dist / 3 + left;
	}
	return left + 1;
}

int main(int argc, char* argv[]) {

	int a[3] = {0};

	for(int i = 0; i < 3; i++) {
		a[i] = search(a, i, -101, 101);
	}
	
	answer(a[0], a[1], a[2]);

    return 0;
}
0