結果

問題 No.582 キャンディー・ボックス3
ユーザー FromBooskaFromBooska
提出日時 2024-03-18 13:30:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 55,608 KB
最終ジャッジ日時 2024-03-18 13:30:54
合計ジャッジ時間 2,248 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 40 ms
53,460 KB
testcase_04 AC 40 ms
53,460 KB
testcase_05 AC 40 ms
53,460 KB
testcase_06 AC 40 ms
53,460 KB
testcase_07 AC 40 ms
53,460 KB
testcase_08 AC 40 ms
53,460 KB
testcase_09 AC 39 ms
53,460 KB
testcase_10 AC 44 ms
53,460 KB
testcase_11 AC 40 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 40 ms
53,460 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 40 ms
53,460 KB
testcase_16 AC 39 ms
53,460 KB
testcase_17 AC 39 ms
53,460 KB
testcase_18 AC 40 ms
55,608 KB
testcase_19 AC 40 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# ニム、Grundy数ではないの? なぜダメなんだ?
# Aが勝つには、Aが最初の手を打って、残りがすべて1で偶数個ある場合のみ

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
ans = 'B'
if N == 1:
    if A[0] == 1:
        ans = 'A'
else:
    counted = Counter(A)
    N_nonzero = N-counted[0]
    if counted[1]==N_nonzero:
        if N_nonzero%2==1:
            ans = 'A'
    else:
        if counted[1]==N_nonzero-1 and counted[2]==1 and N_nonzero%2==0:
            ans = 'A'
print(ans)
0