結果
問題 | No.103 素因数ゲーム リターンズ |
ユーザー |
![]() |
提出日時 | 2015-04-13 22:43:56 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 14 ms / 5,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 56 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,784 KB |
最終ジャッジ日時 | 2024-07-04 14:17:25 |
合計ジャッジ時間 | 1,412 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
#!/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'