結果

問題 No.582 キャンディー・ボックス3
コンテスト
ユーザー lam6er
提出日時 2025-03-31 17:50:58
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 231 ms
コンパイル使用メモリ 95,856 KB
実行使用メモリ 79,076 KB
最終ジャッジ日時 2026-07-08 05:24:41
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
candies = list(map(int, input().split()))

count_k = 0  # number of boxes with exactly 1 candy
count_m = 0  # number of boxes with more than 1 candy

for c in candies:
    if c == 1:
        count_k += 1
    elif c > 1:
        count_m += 1

if count_m == 0:
    # All boxes are 0 or 1; only 1's matter
    if count_k % 2 == 1:
        print("A")
    else:
        print("B")
else:
    # At least one box with more than 1; parity of count_k determines outcome
    if count_k % 2 == 1:
        print("A")
    else:
        print("B")
0