結果
問題 | No.594 壊れた宝物発見機 |
ユーザー | とばり |
提出日時 | 2018-09-07 19:05:54 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 838 bytes |
コンパイル時間 | 1,607 ms |
コンパイル使用メモリ | 164,412 KB |
実行使用メモリ | 24,384 KB |
平均クエリ数 | 44.10 |
最終ジャッジ日時 | 2023-09-23 16:18:33 |
合計ジャッジ時間 | 5,177 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 103 ms
23,820 KB |
testcase_03 | AC | 98 ms
23,640 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 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 102 ms
23,352 KB |
testcase_15 | AC | 101 ms
23,964 KB |
testcase_16 | AC | 103 ms
23,520 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; using int64 = long long; using uint64 = unsigned long long; int ask(int pi, int n) { cout << "?"; for (int i = 0; i < 3; i++) { cout << " " << (i == pi ? n : 0); } cout << endl; int D; cin >> D; return D; } // 第i成分を複数回の質問により特定する int determine(int pi) { int lb = -1, ub = 150; while (ub - lb > 1) { int mid = (ub + lb) / 2; int D1 = ask(pi, mid), D2 = ask(pi, mid + 1); if (D1 <= D2) ub = mid; else lb = mid; } return ub; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int x = determine(0), y = determine(1), z = determine(2); cout << "! " << x << " " << y << " " << z << endl; return 0; }