結果

問題 No.594 壊れた宝物発見機
ユーザー Lepton_sLepton_s
提出日時 2017-11-19 16:25:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,788 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 89,080 KB
実行使用メモリ 24,516 KB
平均クエリ数 73.50
最終ジャッジ日時 2023-09-23 15:07:25
合計ジャッジ時間 4,044 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int cnt = 0;

void answer(int *a){
	if(cnt>200) return;
	printf("! %d %d %d\n", a[0], a[1], a[2]);
	fflush(stdout);
}

int ask(int *a){
	cnt++;
	printf("? %d %d %d\n", a[0], a[1], a[2]);
	fflush(stdout);
	int d;
	scanf("%d", &d);
	return d;
}

void calc(int *a, int p){
	int lb = -100, ub = 100;
	while(ub-lb>10){
		int lb2 = (2*lb+ub)/3;
		a[p] = lb2;
		int l = ask(a);
		int ub2 = (lb+2*ub)/3;
		a[p] = ub2;
		int r = ask(a);
		if(l<r) ub = ub2;
		else lb = lb2;
	}
	a[p] = lb;
	int x = ask(a);
	while(true){
		a[p]++;
		int y = ask(a);
		if(y<x) continue;
		--a[p];
		return;
	}
}

int main(){
	int a[3] = {0, 0, 0};
	rep(i, 3) calc(a, i);
	answer(a);
	return 0;
}
0