結果

問題 No.103 素因数ゲーム リターンズ
ユーザー IgrmiIgrmi
提出日時 2021-06-20 00:00:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 622 bytes
コンパイル時間 893 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 76,004 KB
最終ジャッジ日時 2023-09-05 01:16:00
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,272 KB
testcase_01 AC 73 ms
71,144 KB
testcase_02 AC 73 ms
71,280 KB
testcase_03 AC 74 ms
71,084 KB
testcase_04 AC 74 ms
71,208 KB
testcase_05 AC 73 ms
71,304 KB
testcase_06 AC 75 ms
71,156 KB
testcase_07 AC 75 ms
71,044 KB
testcase_08 AC 73 ms
70,900 KB
testcase_09 AC 73 ms
71,044 KB
testcase_10 AC 73 ms
71,240 KB
testcase_11 AC 73 ms
71,316 KB
testcase_12 AC 77 ms
75,956 KB
testcase_13 AC 75 ms
75,776 KB
testcase_14 AC 76 ms
75,944 KB
testcase_15 AC 78 ms
76,004 KB
testcase_16 AC 74 ms
71,332 KB
testcase_17 AC 77 ms
75,868 KB
testcase_18 AC 74 ms
71,088 KB
testcase_19 AC 77 ms
75,940 KB
testcase_20 AC 74 ms
71,296 KB
testcase_21 AC 73 ms
71,300 KB
testcase_22 AC 73 ms
71,052 KB
testcase_23 AC 73 ms
71,296 KB
testcase_24 AC 77 ms
75,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Grundy = [0] * 15
for i in range(1, 15):
    S = {Grundy[i - 1]}
    if i > 1: S.add(Grundy[i - 2])
    for j in range(3):
        if j not in S:
            Grundy[i] = j
            break

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

Num = [i for i in range(101)]
Prime = []
for i in range(2, 101):
    if i != Num[i]: continue
    Prime.append(i)
    for j in range(i + i, 101, i):
        Num[j] = 0

Xor = 0
for m in M:
    for P in Prime:
        Q = 0
        while m % P == 0:
            m //= P
            Q += 1
        Xor ^= Grundy[Q]
    if m != 1: Xor ^= Grundy[1]
print('Alice' if Xor else 'Bob')
0