結果

問題 No.103 素因数ゲーム リターンズ
ユーザー asumo0729asumo0729
提出日時 2023-01-19 23:13:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 5,000 ms
コード長 1,577 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 80,200 KB
最終ジャッジ日時 2023-09-04 17:31:38
合計ジャッジ時間 6,880 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
79,964 KB
testcase_01 AC 184 ms
79,984 KB
testcase_02 AC 181 ms
80,100 KB
testcase_03 AC 179 ms
79,744 KB
testcase_04 AC 181 ms
80,064 KB
testcase_05 AC 181 ms
80,200 KB
testcase_06 AC 181 ms
80,104 KB
testcase_07 AC 182 ms
79,920 KB
testcase_08 AC 184 ms
79,860 KB
testcase_09 AC 184 ms
79,668 KB
testcase_10 AC 182 ms
79,932 KB
testcase_11 AC 183 ms
79,848 KB
testcase_12 AC 185 ms
79,920 KB
testcase_13 AC 183 ms
79,648 KB
testcase_14 AC 181 ms
79,680 KB
testcase_15 AC 181 ms
79,864 KB
testcase_16 AC 182 ms
79,788 KB
testcase_17 AC 183 ms
80,120 KB
testcase_18 AC 179 ms
80,112 KB
testcase_19 AC 180 ms
79,912 KB
testcase_20 AC 178 ms
79,924 KB
testcase_21 AC 181 ms
79,964 KB
testcase_22 AC 179 ms
80,096 KB
testcase_23 AC 188 ms
79,796 KB
testcase_24 AC 181 ms
79,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
from collections import defaultdict, deque
import heapq
from heapq import heapify, heappop, _heapify_max, heappush
from bisect import bisect_left, bisect_right
import math
import itertools
import copy

stdin=sys.stdin
#sys.setrecursionlimit(10 ** 7)
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
inf = 1 << 60
mod = 10 ** 9 + 7
mod = 998244353
eps = 1e-9
sortkey1 = itemgetter(0)
sortkey2 = lambda x: (x[0], x[1])
# sort(key=lambda x:(x[1], x[2]))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

###############################################################

N = ip()
M = lp()
grundy = [0 for _ in range(10000+1)]
for i in range(2,10001):
    arr = factorization(i)
    mex = [0 for _ in range(101)]
    # 遷移先のgrundyをかきあつめ、mexをとる
    for p, _ in arr:
        mex[grundy[i//p]] += 1
        if i%(p*p) == 0:
            mex[grundy[i//(p*p)]] += 1
    res = 0
    while mex[res]:
        res += 1
    grundy[i] = res

ans = 0
for m in M:
    ans ^= grundy[m]
if ans:
    print('Alice')
else:
    print('Bob')
0