結果

問題 No.3246 80% Accuracy Calculator
ユーザー AngrySadEight
提出日時 2025-07-26 17:41:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,456 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 83,080 KB
実行使用メモリ 34,016 KB
平均クエリ数 0.86
最終ジャッジ日時 2025-07-27 02:49:36
合計ジャッジ時間 11,947 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
using ll = long long;

ll get_most(char reg, ll times) {
    map<ll, ll> mp;

    for (ll i = 0; i < times; i++) {
        cout << "? " << reg << endl;
        ll val;
        cin >> val;
        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 x = get_most('A', 5);
    ll y = get_most('B', 5);

    ll now = 2;
    for (ll i = 0; i < y; i++) {
        if (now == 2) {
            while (true) {
                cout << "+ A C B" << endl;
                ll z;
                cin >> z;
                assert(z == 0);
                ll val = get_most('B', 2);
                if (val == i * x + x) {
                    break;
                }
            }
            now = 1;
        } else {
            while (true) {
                cout << "+ A B C" << endl;
                ll z;
                cin >> z;
                assert(z == 0);
                ll val = get_most('C', 2);
                if (val == i * x + x) {
                    break;
                }
            }
            now = 2;
        }
    }
    if (now == 1) {
        cout << "! B" << endl;
    } else {
        cout << "! C" << endl;
    }
}
0