結果
| 問題 |
No.594 壊れた宝物発見機
|
| ユーザー |
TangentDay
|
| 提出日時 | 2017-11-10 22:42:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 119 ms / 2,000 ms |
| コード長 | 1,376 bytes |
| コンパイル時間 | 611 ms |
| コンパイル使用メモリ | 81,488 KB |
| 実行使用メモリ | 25,488 KB |
| 平均クエリ数 | 46.60 |
| 最終ジャッジ日時 | 2024-07-16 14:26:49 |
| 合計ジャッジ時間 | 4,349 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
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 calc(int i){
int l = -101, r = 101;
while (r - l > 2){
int m1 = (r - l) / 2 + l;
int m2 = m1 + 1;
int d1, d2;
if (i == 0){
d1 = ask(m1, 0, 0);
d2 = ask(m2, 0, 0);
}else if (i == 1){
d1 = ask(0, m1, 0);
d2 = ask(0, m2, 0);
}else{
d1 = ask(0, 0, m1);
d2 = ask(0, 0, m2);
}
if (d1 < d2) r = m2;
else l = m1;
}
return l + 1;
}
int main() {
answer(calc(0), calc(1), calc(2));
return 0;
}
TangentDay