結果

問題 No.1716 Bonus Nim
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-10-22 22:30:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 1,649 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 131,408 KB
最終ジャッジ日時 2023-10-24 13:48:34
合計ジャッジ時間 4,399 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,476 KB
testcase_01 AC 38 ms
53,476 KB
testcase_02 AC 37 ms
53,476 KB
testcase_03 AC 36 ms
53,476 KB
testcase_04 AC 123 ms
109,024 KB
testcase_05 AC 130 ms
114,572 KB
testcase_06 AC 123 ms
110,612 KB
testcase_07 AC 124 ms
104,924 KB
testcase_08 AC 122 ms
110,440 KB
testcase_09 AC 130 ms
107,388 KB
testcase_10 AC 121 ms
109,320 KB
testcase_11 AC 129 ms
107,464 KB
testcase_12 AC 124 ms
106,968 KB
testcase_13 AC 142 ms
129,968 KB
testcase_14 AC 129 ms
119,560 KB
testcase_15 AC 176 ms
76,740 KB
testcase_16 WA -
testcase_17 AC 35 ms
53,476 KB
testcase_18 AC 35 ms
53,476 KB
testcase_19 WA -
testcase_20 AC 36 ms
53,476 KB
testcase_21 WA -
testcase_22 AC 134 ms
118,928 KB
testcase_23 AC 131 ms
117,720 KB
testcase_24 AC 124 ms
114,440 KB
testcase_25 AC 138 ms
131,408 KB
testcase_26 AC 132 ms
117,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

Nimだよな…

1 | A_i で考える

0 = 0
1 = 1
1 | 0 = 1
1 | 1 = 0
1 | 2 = 2

無くなった時、より多くのコインを持っている方が良い。

Nが奇数の場合
Aがどんどん取ると、絶対勝てる

Nが偶の場合
先手 = 最初にコインを得た方が負ける

"""

from sys import stdin

TT = int(stdin.readline())

for loop in range(TT):

    N = int(stdin.readline())

    A = list(map(int,stdin.readline().split()))

    if N % 2 == 1:
        print ("Alice")
        continue

    else:

        x = 0
        for i in A:
            x ^= i-1

        if x == 0:
            print ("Bob")
        else:
            print ("Alice")
0