結果

問題 No.594 壊れた宝物発見機
ユーザー kk
提出日時 2020-09-09 01:02:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 199,720 KB
実行使用メモリ 24,240 KB
平均クエリ数 47.00
最終ジャッジ日時 2023-09-24 06:38:09
合計ジャッジ時間 4,760 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
24,024 KB
testcase_01 AC 85 ms
24,048 KB
testcase_02 AC 91 ms
23,664 KB
testcase_03 AC 88 ms
24,048 KB
testcase_04 AC 89 ms
23,424 KB
testcase_05 AC 89 ms
23,868 KB
testcase_06 AC 91 ms
24,240 KB
testcase_07 AC 86 ms
24,048 KB
testcase_08 AC 84 ms
23,688 KB
testcase_09 AC 85 ms
23,688 KB
testcase_10 AC 88 ms
24,072 KB
testcase_11 AC 88 ms
23,856 KB
testcase_12 AC 91 ms
23,676 KB
testcase_13 AC 84 ms
24,048 KB
testcase_14 AC 86 ms
23,712 KB
testcase_15 AC 89 ms
24,228 KB
testcase_16 AC 86 ms
23,436 KB
testcase_17 AC 85 ms
23,676 KB
testcase_18 AC 85 ms
23,412 KB
testcase_19 AC 93 ms
23,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int ask(int t, int x) {
  cout << "?";
  REP (i, 3)
    cout << " " << (i == t ? x : 0);
  cout << endl;
  int d;
  cin >> d;
  return d;
}

void ans(int x, int y, int z) {
  cout << "! " << x << " " << y << " " << z << endl;
  cout.flush();
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  vector<int> ret;
  REP (t, 3) {
    int lo = -101;
    int hi = 100;
    while (hi - lo > 1) {
      int mi = (lo+hi)/2;
      if (ask(t, mi) < ask(t, mi+1))
        hi = mi;
      else
        lo = mi;
    }
    ret.push_back(hi);
  }
  
  ans(ret[0], ret[1], ret[2]);
  
  return 0;
}
0