結果

問題 No.103 素因数ゲーム リターンズ
ユーザー yuppe19 😺
提出日時 2015-05-17 09:45:44
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 04:59:17
合計ジャッジ時間 1,283 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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