結果
| 問題 |
No.594 壊れた宝物発見機
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2018-06-23 10:40:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 1,159 bytes |
| コンパイル時間 | 1,624 ms |
| コンパイル使用メモリ | 167,544 KB |
| 実行使用メモリ | 25,616 KB |
| 平均クエリ数 | 70.20 |
| 最終ジャッジ日時 | 2024-07-16 15:52:49 |
| 合計ジャッジ時間 | 5,058 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include "bits/stdc++.h"
#define REP(i,n,N) for(int i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod= 1e10;
void answer(int *a){
printf("! %d %d %d\n", a[0], a[1], a[2]);
fflush(stdout);
}
int ask(int *a){
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 = 101;
while(ub-lb>5){
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){
x = y;
continue;
}
--a[p];
return;
}
}
int main(){
int a[3] = {0, 0, 0};
REP(i,0, 3) calc(a, i);
answer(a);
return 0;
}
dnish