結果

問題 No.582 キャンディー・ボックス3
コンテスト
ユーザー 梧桐
提出日時 2026-01-23 01:06:30
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 746 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 734 ms
コンパイル使用メモリ 80,684 KB
実行使用メモリ 16,208 KB
最終ジャッジ日時 2026-01-23 01:06:35
合計ジャッジ時間 4,574 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other WA * 9 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>

using namespace std;

int n, one, two, three;

void Solve() {
    one = two = 0;
    scanf("%d", &n);
    if (n == 1) {
        int x;
        scanf("%d", &x);
        puts(x == 1 ? "A" : "B");
    } else {
        for (int i = 1, x; i <= n; ++i) {
            scanf("%d", &x);
            if (x == 1) ++one;
            else if (x == 2) ++two;
            else three = true;
        }
        if (three || two >= 2) puts("B");
        else {
            if (two == 1) one += 2;
            puts(one % 2 ? "A" : "B");
        }
    }
}

int main() {
    // freopen("game.in", "r", stdin);
    // freopen("game.out", "w", stdout);
    
    int t;
    scanf("%d", &t);
    while (t--) {
        Solve();
    }

    return 0;
}
0