結果
| 問題 | No.103 素因数ゲーム リターンズ | 
| コンテスト | |
| ユーザー |  vwxyz | 
| 提出日時 | 2022-08-10 04:29:16 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 30 ms / 5,000 ms | 
| コード長 | 501 bytes | 
| コンパイル時間 | 505 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-09-20 08:54:40 | 
| 合計ジャッジ時間 | 1,864 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 20 | 
ソースコード
from collections import defaultdict
import sys
readline=sys.stdin.readline
def Factorize(N):
    assert N>=1
    factors=defaultdict(int)
    for p in range(2,N):
        if p**2>N:
            break
        while N%p==0:
            factors[p]+=1
            N//=p
    if N!=1:
        factors[N]+=1
    return factors
N=int(readline())
grundy=0
for M in map(int,readline().split()):
    for p,e in Factorize(M).items():
        grundy^=e%3
if grundy:
    ans="Alice"
else:
    ans="Bob"
print(ans)
            
            
            
        