結果

問題 No.103 素因数ゲーム リターンズ
コンテスト
ユーザー ntuda
提出日時 2024-10-21 22:25:31
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 32 ms / 5,000 ms
+ 364µs
コード長 547 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 72 ms
コンパイル使用メモリ 80,512 KB
実行使用メモリ 61,696 KB
最終ジャッジ日時 2026-09-19 03:21:26
合計ジャッジ時間 2,711 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def n_fact(N):
    c = collections.Counter(prime_factorize(N))
    return c

N = int(input())
M = list(map(int, input().split()))
X = 0
for m in M:
    for v in n_fact(m).values():
        X ^= v % 3
if X == 0:
    print("Bob")
else:
    print("Alice")
0