結果
問題 |
No.3246 80% Accuracy Calculator
|
ユーザー |
![]() |
提出日時 | 2025-07-27 02:59:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,118 bytes |
コンパイル時間 | 883 ms |
コンパイル使用メモリ | 82,944 KB |
実行使用メモリ | 26,492 KB |
平均クエリ数 | 7585.09 |
最終ジャッジ日時 | 2025-07-27 02:59:21 |
合計ジャッジ時間 | 17,024 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 RE * 36 |
ソースコード
#include <cassert> #include <iostream> #include <map> #include <vector> using namespace std; using ll = long long; ll get_most(char reg, ll times, ll &all_times) { map<ll, ll> mp; for (ll i = 0; i < times; i++) { cout << "? " << reg << endl; all_times++; ll val; cin >> val; if (val == -1) { return -1; } mp[val]++; } ll max_times = 0; ll max_val = -1; for (auto it = mp.begin(); it != mp.end(); it++) { if (max_times < it->second) { max_times = it->second; max_val = it->first; } } return max_val; } int main() { ll all_times = 0; ll x = get_most('A', 50, all_times); ll y = get_most('B', 50, all_times); ll now = 2; for (ll i = 0; i < y; i++) { if (now == 2) { while (true) { cout << "+ A C B" << endl; ll z; cin >> z; if (z != 0) { assert(all_times <= 8888); return 0; } all_times++; ll val = get_most('B', 7, all_times); if (val == -1) { assert(all_times <= 8888); return 0; } if (val == i * x + x) { break; } } now = 1; } else { while (true) { cout << "+ A B C" << endl; all_times++; ll z; cin >> z; if (z != 0) { assert(all_times <= 8888); return 0; } ll val = get_most('C', 7, all_times); if (val == -1) { assert(all_times <= 8888); return 0; } if (val == i * x + x) { break; } } now = 2; } } if (now == 1) { cout << "! B" << endl; } else { cout << "! C" << endl; } }