結果
| 問題 | No.594 壊れた宝物発見機 | 
| コンテスト | |
| ユーザー |  ferin | 
| 提出日時 | 2017-11-10 23:34:37 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 104 ms / 2,000 ms | 
| コード長 | 2,449 bytes | 
| コンパイル時間 | 1,253 ms | 
| コンパイル使用メモリ | 159,780 KB | 
| 実行使用メモリ | 25,472 KB | 
| 平均クエリ数 | 86.00 | 
| 最終ジャッジ日時 | 2024-07-16 14:35:35 | 
| 合計ジャッジ時間 | 4,531 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
// #define DEBUG
int ansx = -55, ansy = 15, ansz = 20;
double query(int x, int y, int z) {
  #ifdef DEBUG
    return sqrt((x-ansx)*(x-ansx) + (y-ansy)*(y-ansy) + (z-ansz)*(z-ansz));
  #else
    cout << "? " << x << " " << y << " " << z << endl;
    int res;
    cin >> res;
    return res;
  #endif
}
signed main(void)
{
  int x0 = -150, x3 = 150;
  while(x3-x0 > 2) {
    int x1 = (2*x0+x3)/3, x2 = (x0+2*x3)/3;
    // cout << x0 << " " << x1 << " " << x2 << " " << x3 << endl;
    // cout << query(x1, 0, 0) << " " << query(x2, 0, 0) << endl;
    if(query(x1, 0, 0) <= query(x2, 0, 0)) {
      x3 = x2;
    } else {
      x0 = x1;
    }
  }
  // cout << x0 << " " << x3 << endl;
  int x;
  double mi = INF;
  FOR(i, x0, x3+1) {
    double ret = query(i, 0, 0);
    if(ret < mi) {
      mi = ret;
      x = i;
    }
  }
  x0 = -150, x3 = 150;
  while(x3-x0 > 2) {
    int x1 = (2*x0+x3)/3, x2 = (x0+2*x3)/3;
    if(query(0, x1, 0) <= query(0, x2, 0)) {
      x3 = x2;
    } else {
      x0 = x1;
    }
  }
  // cout << x0 << " " << x3 << endl;
  int y;
  mi = INF;
  FOR(i, x0, x3+1) {
    double ret = query(0, i, 0);
    // cout << i << " " << ret << endl;
    if(ret < mi) {
      mi = ret;
      y = i;
    }
  }
  x0 = -150, x3 = 150;
  while(x3-x0 > 2) {
    int x1 = (2*x0+x3)/3, x2 = (x0+2*x3)/3;
    if(query(0, 0, x1) <= query(0, 0, x2)) {
      x3 = x2;
    } else {
      x0 = x1;
    }
  }
  // cout << x0 << " " << x3 << endl;
  int z;
  mi = INF;
  FOR(i, x0, x3+1) {
    double ret = query(0, 0, i);
    if(ret < mi) {
      mi = ret;
      z = i;
    }
  }
  cout << "! " << x << " " << y << " " << z << endl;
  return 0;
}
            
            
            
        