結果

問題 No.582 キャンディー・ボックス3
コンテスト
ユーザー WutongDeath
提出日時 2026-02-02 16:21:37
言語 C++14
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 491 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 277 ms
コンパイル使用メモリ 72,704 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-21 00:41:38
合計ジャッジ時間 1,580 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>

using namespace std;

int t, n;

int main() {
    scanf("%d", &n);
    int cnt1 = 0, cnt2 = 0;
    for (int i = 1, x; i <= n; ++i) {
        scanf("%d", &x);
        if (x == 1) ++cnt1;
        else if (x == 2) ++cnt2;
    }

    if (n == 2 && cnt1 + cnt2 == n || ((cnt1 + cnt2 * 2) % 2 == 1)) puts("A");
    else if (cnt1 + cnt2 != n || (cnt2 == 0 && cnt1 % 2 == 0) || (cnt1 == 0 && cnt2 != 0) || (cnt1 > 0 && cnt2 > 0)) puts("B");
    else puts("A");

    return 0;
}
0