結果

問題 No.594 壊れた宝物発見機
ユーザー rsk0315rsk0315
提出日時 2019-01-09 23:31:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 910 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 30,952 KB
実行使用メモリ 24,336 KB
平均クエリ数 46.90
最終ジャッジ日時 2023-09-23 16:43:02
合計ジャッジ時間 3,530 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>

int inquiry(int x, int y, int z) {
  printf("? %d %d %d\n", x, y, z);
  fflush(stdout);
  int d;
  scanf("%d", &d);
  return d;
}

int main() {
  int X;
  {
    int lb = -100;
    int ub = 101;
    while (ub-lb > 1) {
      int mid = (lb+ub) >> 1;
      int d0 = inquiry(mid, 0, 0);
      int d1 = inquiry(mid+1, 0, 0);
      ((d0 > d1)? lb:ub) = mid;
    }
    X = lb;
  }

  int Y;
  {
    int lb = -100;
    int ub = 101;
    while (ub-lb > 1) {
      int mid = (lb+ub) >> 1;
      int d0 = inquiry(X, mid, 0);
      int d1 = inquiry(X, mid+1, 0);
      ((d0 > d1)? lb:ub) = mid;
    }
    Y = lb;
  }

  int Z;
  {
    int lb = -100;
    int ub = 101;
    while (ub-lb > 1) {
      int mid = (lb+ub) >> 1;
      int d0 = inquiry(X, Y, mid);
      int d1 = inquiry(X, Y, mid+1);
      ((d0 > d1)? lb:ub) = mid;
    }
    Z = lb;
  }
  printf("! %d %d %d\n", X, Y, Z);
  fflush(stdout);
}
0