結果

問題 No.103 素因数ゲーム リターンズ
ユーザー PNJ
提出日時 2023-06-27 19:48:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-04 12:21:42
合計ジャッジ時間 1,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def Prime(n):
  p = 2
  q = 0
  ans = []
  while p <= n**0.5:
    while n % p == 0:
      n //= p
      q += 1
    if q == 0:
      p += 1
      continue
    ans.append([p,q])
    p += 1
    q = 0
  if n > 1:
    ans.append([n,1])
  return ans

N = int(input())
M = list(map(int,input().split()))
G = []
for i in range(N):
  m = M[i]
  pm = Prime(m)
  g = 0
  for p,q in pm:
    q %= 3
    g ^= q
  G.append(g)

ans = 0
for g in G:
  ans ^= g
if ans != 0:
  print('Alice')
else:
  print('Bob')
0