結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 101 ms
23,976 KB
testcase_02 WA -
testcase_03 AC 102 ms
23,388 KB
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 AC 99 ms
24,084 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 97 ms
23,364 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 99 ms
23,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
//typedef long long ll;

#define INF (1LL << 31 - 1)
#define INFLL ((1LL << 62) - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) for (int i = n; i >= 0; --i)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

int vx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, vy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

inline bool check(int ux, int uy, int x, int y) {
  return (0 <= x and x < ux and 0 <= y and y < uy);
}

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int bx, ux, by, uy, bz, uz, x, y, z;
ll d, l, r;

inline void answer(int X, int Y, int Z) {
  cout << "!" << " " << X << " " << Y << " " << Z << endl;
}

inline ll query(int X, int Y, int Z) {
  ll ret;
  cout << "?" << " " << X << " " << Y << " " << Z << endl;
  cin >> ret;
  return ret;
}

int main() {
  init();
  bx = by = bz = -150;
  ux = uy = uz = 150;
  x = y = z = INF;

  while (ux - bx > 1) {
    l = query(bx, by, bz);
    r = query(ux, by, bz);
    if (l == r) {
      x = (bx + ux) / 2;
      break;
    }
    else if (l < r) {
      ux = (bx + ux) / 2;
    }
    else {
      bx = (bx + ux) / 2;
    }
  }

  while (uy - by > 1) {
    l = query(x, by, bz);
    r = query(x, uy, bz);
    if (l == r) {
      y = (by + uy) / 2;
      break;
    }
    else if (l < r) {
      uy = (by + uy) / 2;
    }
    else by = (by + uy) / 2;
  }

  while (uz - bz > 1) {
    l = query(x, y, bz);
    r = query(x, y, uz);
    if (l == r) {
      z = (bz + uz) / 2;
      break;
    }
    else if (l < r) {
      uz = (bz + uz) / 2;
    }
    else bz = (bz + uz) / 2;
  }

  answer(x, y, z);

  return 0;
}
0