結果

問題 No.3246 80% Accuracy Calculator
コンテスト
ユーザー t98slider
提出日時 2025-08-22 23:22:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,156 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 199,032 KB
実行使用メモリ 26,356 KB
平均クエリ数 206.95
最終ジャッジ日時 2025-08-22 23:22:31
合計ジャッジ時間 6,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 1 TLE * 1 -- * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    constexpr int r = 19;
    array<int, r> tmp;
    auto ask1 = [&](char c){
        for(int i = 0; i < r; i++){
            cout << "? " << c << endl;
            cin >> tmp[i];
        }
        sort(tmp.begin(), tmp.end());
        pair<int,int> mx;
        for(int i = 0; i < r; ){
            int p = i;
            while(i < r && tmp[i] == tmp[p]) i++;
            mx = max(mx, make_pair(i - p, tmp[p]));
        }
        return mx.second;
    };
    auto ask2 = [&](char c0, char c1, char c2){
        int res;
        cout << "+ " << c0 << " " << c1 << " " << c2 << endl;
        cin >> res;
        assert(res == 0);
    };
    int x = ask1('A');
    int y = ask1('B');
    int v = 0;
    char c0 = 'A', c1 = 'B';
    while(y){
        if(y & 1){
            v += x;
            do{
                ask2(c0, c0, 'C');
            }while(ask1('C') != v);
        }
        do{
            ask2(c0, c0, c1);
        }while(ask1('C') != 2 * x);
        x += x;
        swap(c0, c1);
    }
    cout << "! C" << endl; 
}
0