結果

問題 No.582 キャンディー・ボックス3
ユーザー FromBooskaFromBooska
提出日時 2023-03-17 08:15:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 53,536 KB
最終ジャッジ日時 2023-10-18 13:30:35
合計ジャッジ時間 2,635 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

# Grundy数
# 制約の下での各山のGrundy数を求める
# 全山のGrundy数のxor sumが0であれば先攻の人は負ける

N = int(input())
C = list(map(int, input().split()))

# この問題の制約でGrundy数を考えると先行が勝てる単独の山はキャンディが1個の山だけ
# 通常はここをdpや0から積み上げで求める

grundy = [0]*N
for i in range(N):
    if C[i] == 1:
        grundy[i] = 1

xor_sum = 0
for i in range(N):
    xor_sum ^= grundy[i]

if xor_sum == 0:
    print('B')
else:
    print('A')
0