結果

問題 No.103 素因数ゲーム リターンズ
コンテスト
ユーザー (ΦωΦ)
提出日時 2015-04-13 22:43:56
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 557 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 119 ms
コンパイル使用メモリ 77,464 KB
最終ジャッジ日時 2025-12-03 14:38:46
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/python
from collections import defaultdict
from operator import xor
from itertools import chain

def factorize(n):
    res = defaultdict(int)
    d = 2
    while d * d <= n:
        while n % d == 0:
            res[d] += 1
            n /= d
        d += 1
    if n > 1:
        res[n] += 1
    return res

flatten = lambda listOfLists: chain.from_iterable(listOfLists)

N = int(raw_input())
vs = [map(lambda x: x%3, e) for e in map(lambda e: factorize(int(e)).values(), raw_input().split())]
print 'Alice' if reduce(xor, flatten(vs)) else 'Bob'
0