結果

問題 No.594 壊れた宝物発見機
ユーザー HIR180HIR180
提出日時 2017-11-10 22:55:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,771 bytes
コンパイル時間 1,343 ms
コンパイル使用メモリ 144,560 KB
実行使用メモリ 24,516 KB
平均クエリ数 70.00
最終ジャッジ日時 2023-09-23 14:49:23
合計ジャッジ時間 4,640 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int xx=12,yy=-78,zz=99;
// 質問クエリ
int ask(int x, int y, int z) {
	x-=200; y-=200; z-=200;
	int d;
/*	int X = (x-xx)*(x-xx)+(y-yy)*(y-yy)+(z-zz)*(z-zz);
	return X;*/
	cout << "?" << " " << x << " " << y << " " << z << endl;
	cin >> d;
	return d;
}

// 回答クエリ
void answer(int x, int y, int z) {
	x-=200; y-=200; z-=200;
	cout << "!" << " " << x << " " << y << " " << z << endl;
}

void calc(int xa,int xb,int ya,int yb,int za,int zb){
	if(xa == xb && ya == yb && za == zb){
		answer(xa,ya,za); return;
	}
	cout<<xa<<xb<<ya<<yb<<za<<zb<<endl;
	if(za != zb){
		int mid = (za+zb)/2;
		int V = ask(xa,ya,mid);
		int VV = ask(xa,ya,mid+1);
		if(V < VV) return calc(xa,xb,ya,yb,za,mid);
		else return calc(xa,xb,ya,yb,mid+1,zb);
	}
	if(ya != yb){
		int mid = (ya+yb)/2;
		int V = ask(xa,mid,za);
		int VV = ask(xa,mid+1,za);
		if(V < VV) return calc(xa,xb,ya,mid,za,zb);
		else return calc(xa,xb,mid+1,yb,za,zb);
	}
	{
		int mid = (xa+xb)/2;
		int V = ask(mid,ya,za);
		int VV = ask(mid+1,ya,za);
		if(V < VV) return calc(xa,mid,ya,yb,za,zb);
		else return calc(mid+1,xb,ya,yb,za,zb);
	}
}
int main(void) {
	calc(-100+200,100+200,-100+200,100+200,-100+200,100+200);
	return 0;
}
0