結果

問題 No.103 素因数ゲーム リターンズ
ユーザー chocoruskchocorusk
提出日時 2020-09-13 09:18:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 900 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 9,480 KB
最終ジャッジ日時 2023-09-02 09:42:36
合計ジャッジ時間 2,820 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
9,332 KB
testcase_01 AC 44 ms
9,472 KB
testcase_02 AC 44 ms
9,380 KB
testcase_03 AC 44 ms
9,428 KB
testcase_04 AC 43 ms
9,416 KB
testcase_05 AC 44 ms
9,336 KB
testcase_06 AC 44 ms
9,480 KB
testcase_07 AC 44 ms
9,312 KB
testcase_08 AC 43 ms
9,372 KB
testcase_09 AC 44 ms
9,420 KB
testcase_10 AC 44 ms
9,380 KB
testcase_11 AC 44 ms
9,372 KB
testcase_12 AC 44 ms
9,468 KB
testcase_13 AC 44 ms
9,380 KB
testcase_14 AC 44 ms
9,432 KB
testcase_15 AC 44 ms
9,392 KB
testcase_16 AC 43 ms
9,268 KB
testcase_17 AC 44 ms
9,340 KB
testcase_18 AC 43 ms
9,340 KB
testcase_19 AC 44 ms
9,376 KB
testcase_20 AC 44 ms
9,336 KB
testcase_21 AC 44 ms
9,328 KB
testcase_22 AC 43 ms
9,320 KB
testcase_23 AC 44 ms
9,440 KB
testcase_24 AC 43 ms
9,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

n=int(readline())
m=list(map(int, readline().split()))
def prime_sieve(n):
    isprime=[True]*(n+1)
    isprime[0]=False
    isprime[1]=False
    for i in range(2, n+1):
        if isprime[i]:
            for j in range(2*i, n+1, i):
                isprime[j]=False
    return isprime
mx=10000
isprime=prime_sieve(mx)
f=[[] for _ in range(mx+1)]
for p, b in enumerate(isprime):
    if not b:
        continue
    for i in range(p, mx+1, p):
        f[i].append(p)
dp=[0]*(mx+1)
for x in range(2, mx+1):
    st=set()
    for p in f[x]:
        x1=x//p
        st.add(dp[x1])
        if x1%p==0:
            st.add(dp[x1//p])
    for i in range(mx+1):
        if i not in st:
            dp[x]=i
            break
s=0
for x in m:
    s^=dp[x]
if s:
    print("Alice")
else:
    print("Bob")
0