結果

問題 No.103 素因数ゲーム リターンズ
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-11 01:17:33
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 323 ms / 5,000 ms
コード長 684 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 77,432 KB
実行使用メモリ 79,736 KB
最終ジャッジ日時 2023-09-06 23:10:06
合計ジャッジ時間 10,419 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 321 ms
79,444 KB
testcase_01 AC 320 ms
79,736 KB
testcase_02 AC 320 ms
79,696 KB
testcase_03 AC 320 ms
79,608 KB
testcase_04 AC 320 ms
79,684 KB
testcase_05 AC 320 ms
79,480 KB
testcase_06 AC 322 ms
79,564 KB
testcase_07 AC 320 ms
79,600 KB
testcase_08 AC 319 ms
79,520 KB
testcase_09 AC 323 ms
79,600 KB
testcase_10 AC 318 ms
79,628 KB
testcase_11 AC 319 ms
79,612 KB
testcase_12 AC 320 ms
79,676 KB
testcase_13 AC 322 ms
79,524 KB
testcase_14 AC 322 ms
79,676 KB
testcase_15 AC 322 ms
79,608 KB
testcase_16 AC 320 ms
79,696 KB
testcase_17 AC 321 ms
79,644 KB
testcase_18 AC 321 ms
79,528 KB
testcase_19 AC 322 ms
79,656 KB
testcase_20 AC 321 ms
79,520 KB
testcase_21 AC 320 ms
79,532 KB
testcase_22 AC 318 ms
79,708 KB
testcase_23 AC 321 ms
79,564 KB
testcase_24 AC 320 ms
79,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
M=map(int,raw_input().split())
grundy = [0 for i in range(10001)]
isPrime=[True for i in range(10001)]
isPrime[0]=False
isPrime[1]=False
for i in range(2,10001):
    if isPrime[i]:
        for j in range(i+i,10001,i):
            isPrime[j]=False
prime=[i for i in range(10001) if isPrime[i]]
for i in xrange(2,10001):
    s=set([])
    for p in prime:
        if i%p==0:
            s.add(grundy[i/p])
            if i%(p*p)==0:
                s.add(grundy[i/p/p])
    for g in xrange(10001):
        if not g in s:
            grundy[i]=g
            break
    #print grundy[i],
g=0
for m in M:
    g^=grundy[m]
if g==0:
    print "Bob"
else:
    print "Alice"

0