結果

問題 No.594 壊れた宝物発見機
ユーザー ふっぴーふっぴー
提出日時 2017-11-11 09:47:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 2,223 bytes
コンパイル時間 1,514 ms
コンパイル使用メモリ 164,532 KB
実行使用メモリ 24,324 KB
平均クエリ数 73.00
最終ジャッジ日時 2023-09-23 15:02:13
合計ジャッジ時間 4,850 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
23,520 KB
testcase_01 AC 107 ms
23,544 KB
testcase_02 AC 106 ms
24,288 KB
testcase_03 AC 105 ms
23,796 KB
testcase_04 AC 102 ms
23,976 KB
testcase_05 AC 103 ms
24,276 KB
testcase_06 AC 103 ms
23,472 KB
testcase_07 AC 103 ms
23,604 KB
testcase_08 AC 105 ms
23,388 KB
testcase_09 AC 101 ms
24,324 KB
testcase_10 AC 101 ms
24,300 KB
testcase_11 AC 105 ms
23,592 KB
testcase_12 AC 104 ms
23,808 KB
testcase_13 AC 101 ms
23,364 KB
testcase_14 AC 99 ms
24,312 KB
testcase_15 AC 102 ms
23,640 KB
testcase_16 AC 101 ms
23,376 KB
testcase_17 AC 102 ms
23,352 KB
testcase_18 AC 99 ms
24,276 KB
testcase_19 AC 99 ms
24,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int i, j;
	int haba = 100;
	int x = 0, y = 0, z = 0;
	while (haba > 0) {
		int zu = z + haba, zd = z - haba;
		int d, du, dd;
		printf("? %d %d %d\n", x, y, z);
		fflush(stdout);
		scanf("%d", &d);
		printf("? %d %d %d\n", x, y, zu);
		fflush(stdout);
		scanf("%d", &du);
		printf("? %d %d %d\n", x, y, zd);
		fflush(stdout);
		scanf("%d", &dd);
		if (du <= d && du <= dd) {
			z = zu;
		}
		else if (dd <= du && dd <= d) {
			z = zd;
		}
		if (haba == 1)
			break;
		haba = (haba + 1) / 2;
	}
	haba = 100;
	while (haba > 0) {
		int yu = y + haba, yd = y - haba;
		int d, du, dd;
		printf("? %d %d %d\n", x, y, z);
		fflush(stdout);
		scanf("%d", &d);
		printf("? %d %d %d\n", x, yu, z);
		fflush(stdout);
		scanf("%d", &du);
		printf("? %d %d %d\n", x, yd, z);
		fflush(stdout);
		scanf("%d", &dd);
		if (du <= d && du <= dd) {
			y = yu;
		}
		else if (dd <= du && dd <= d) {
			y = yd;
		}
		if (haba == 1)
			break;
		haba = (haba + 1) / 2;
	}
	haba = 100;
	while (haba > 0) {
		int xu = x + haba, xd = x - haba;
		int d, du, dd;
		printf("? %d %d %d\n", x, y, z);
		fflush(stdout);
		scanf("%d", &d);
		printf("? %d %d %d\n", xu, y, z);
		fflush(stdout);
		scanf("%d", &du);
		printf("? %d %d %d\n", xd, y, z);
		fflush(stdout);
		scanf("%d", &dd);
		if (du <= d && du <= dd) {
			x = xu;
		}
		else if (dd <= du && dd <= d) {
			x = xd;
		}
		if (haba == 1)
			break;
		haba = (haba + 1) / 2;
	}
	printf("! %d %d %d\n", x, y, z);
	fflush(stdout);
}
0