結果
問題 |
No.582 キャンディー・ボックス3
|
ユーザー |
![]() |
提出日時 | 2023-09-25 11:33:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 524 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 53,916 KB |
最終ジャッジ日時 | 2024-07-18 09:19:33 |
合計ジャッジ時間 | 1,544 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 == 1: print('A') else: print('B')