結果
| 問題 | No.582 キャンディー・ボックス3 | 
| コンテスト | |
| ユーザー |  FromBooska | 
| 提出日時 | 2023-09-25 11:36:49 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 524 bytes | 
| コンパイル時間 | 146 ms | 
| コンパイル使用メモリ | 82,136 KB | 
| 実行使用メモリ | 53,644 KB | 
| 最終ジャッジ日時 | 2024-07-18 09:22:10 | 
| 合計ジャッジ時間 | 1,665 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 WA * 5 | 
ソースコード
# ゲーム、grundy数
# 箱1つで考えると、1のときだけ先手勝ち、あとは後手勝ち
# 箱複数、先手勝ちの時1、後手勝ちのとき0としてxor sum計算
# xor sumが1のとき先手勝ち、0のとき後手勝ち
# https://algo-logic.info/combinatorial-games/#
N = int(input())
C = list(map(int, input().split()))
A = []
for c in C:
    if c == 1:
        A.append(1)
    else:
        A.append(0)
xor_sum = 0
for a in A:
    xor_sum ^= a
if xor_sum == 0:
    print('B')
else:
    print('A')
            
            
            
        