結果
| 問題 |
No.103 素因数ゲーム リターンズ
|
| コンテスト | |
| ユーザー |
asumo0729
|
| 提出日時 | 2023-01-19 22:12:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,348 bytes |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 82,412 KB |
| 実行使用メモリ | 63,956 KB |
| 最終ジャッジ日時 | 2024-06-22 13:56:37 |
| 合計ジャッジ時間 | 2,170 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 15 WA * 5 |
ソースコード
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()
ans = 0
for m in M:
arr = factorization(m)
res = 0
for _, cnt in arr:
if cnt % 3 == 0:
res ^= 0
else:
res ^= 1
ans ^= res
if ans:
print('Alice')
else:
print('Bob')
asumo0729