結果

問題 No.594 壊れた宝物発見機
ユーザー ferinferin
提出日時 2017-11-10 23:34:37
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 2,449 bytes
コンパイル時間 1,154 ms
コンパイル使用メモリ 145,108 KB
実行使用メモリ 24,360 KB
平均クエリ数 86.00
最終ジャッジ日時 2023-09-23 14:56:09
合計ジャッジ時間 4,770 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
23,640 KB
testcase_01 AC 111 ms
24,000 KB
testcase_02 AC 110 ms
24,012 KB
testcase_03 AC 109 ms
23,664 KB
testcase_04 AC 109 ms
24,312 KB
testcase_05 AC 106 ms
23,532 KB
testcase_06 AC 111 ms
23,640 KB
testcase_07 AC 113 ms
24,324 KB
testcase_08 AC 112 ms
23,352 KB
testcase_09 AC 113 ms
23,376 KB
testcase_10 AC 112 ms
23,364 KB
testcase_11 AC 110 ms
23,964 KB
testcase_12 AC 109 ms
23,412 KB
testcase_13 AC 109 ms
23,400 KB
testcase_14 AC 110 ms
24,360 KB
testcase_15 AC 107 ms
23,376 KB
testcase_16 AC 111 ms
23,592 KB
testcase_17 AC 110 ms
23,808 KB
testcase_18 AC 108 ms
23,364 KB
testcase_19 AC 115 ms
23,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#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;
}
0