結果
| 問題 | No.594 壊れた宝物発見機 | 
| コンテスト | |
| ユーザー |  mtsd | 
| 提出日時 | 2017-11-10 22:51:50 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 106 ms / 2,000 ms | 
| コード長 | 1,581 bytes | 
| コンパイル時間 | 730 ms | 
| コンパイル使用メモリ | 72,644 KB | 
| 実行使用メモリ | 25,348 KB | 
| 平均クエリ数 | 82.00 | 
| 最終ジャッジ日時 | 2024-07-16 14:28:00 | 
| 合計ジャッジ時間 | 4,032 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
int ask(int x, int y, int z) {
	int d;
	cout << "?" << " " << x << " " << y << " " << z << endl;
	cin >> d;
	return d;
}
void answer(int x, int y, int z) {
	cout << "!" << " " << x << " " << y << " " << z << endl;
}
int main(){
	int xu=100,xl=-100,yu=100,yl=-100,zu=100,zl=-100;
	int x=0,y=0,z=0;
	while(1){
		if(xu-xl<=2)break;
		int d = (xu-xl)/3;
		int xa = xu-d;
		int xb = xl+d;
		int a = ask(xa,y,z);
		int b = ask(xb,y,z);
		if(a<=b){
			xl = xb;
		}else{
			xu = xa;
		}
	}
	int p;
	int t;
	p = ask(xl,y,z);
	x = xl;
	for(int i=xl+1;i<=xu;i++){
		t = ask(i,y,z);
		if(p>t){
			x = i;
			p = t;
		}
	}
	while(1){
		if(yu-yl<=2)break;
		int d = (yu-yl)/3;
		int ya = yu-d;
		int yb = yl+d;
		int a = ask(x,ya,z);
		int b = ask(x,yb,z);
		if(a<=b){
			yl = yb;
		}else{
			yu = ya;
		}
	}
	p = ask(x,yl,z);
	y = yl;
	for(int i=yl+1;i<=yu;i++){
		t = ask(x,i,z);
		if(p>t){
			y = i;
			p = t;
		}
	}
	while(1){
		if(zu-zl<=2)break;
		int d = (zu-zl)/3;
		int za = zu-d;
		int zb = zl+d;
		int a = ask(x,y,za);
		int b = ask(x,y,zb);
		if(a<=b){
			zl = zb;
		}else{
			zu = za;
		}
	}
	p = ask(x,y,zl);
	z = zl;
	for(int i=zl+1;i<=zu;i++){
		t = ask(x,y,i);
		if(p>t){
			z = i;
			p = t;
		}
	}
	answer(x,y,z);
	return 0;
}
            
            
            
        