結果

問題 No.103 素因数ゲーム リターンズ
ユーザー toyuzuko
提出日時 2020-08-27 20:15:24
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-08 02:26:42
合計ジャッジ時間 1,808 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

def factorize(n):
    if n == 1: return []
    res = []
    x, y = n, 2
    while y * y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

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

g = 0

for m in M:
    c = Counter(factorize(m))
    for v in c.values():
        g ^= v % 3

print('Alice' if g != 0 else 'Bob')
0