結果

問題 No.594 壊れた宝物発見機
ユーザー 小指が強い人
提出日時 2016-06-08 23:43:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 159,836 KB
実行使用メモリ 25,704 KB
平均クエリ数 61.00
最終ジャッジ日時 2024-07-16 10:24:56
合計ジャッジ時間 5,943 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 19
権限があれば一括ダウンロードができます

ソースコード

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

void answer(int x, int y, int z) {
	cout << "!" << " " << x << " " << y << " " << z << endl;
}

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