結果
問題 | No.103 素因数ゲーム リターンズ |
ユーザー |
|
提出日時 | 2024-08-25 14:15:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 49 ms / 5,000 ms |
コード長 | 1,095 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 63,100 KB |
最終ジャッジ日時 | 2024-08-25 14:15:10 |
合計ジャッジ時間 | 2,184 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
def prime_numbers(x) :if x < 2 :return []prime = []for i in range(2, int(x**0.5) + 1) :while x % i == 0 :prime.append(i)x //= iif x > 1 :prime.append(x)return prime##########################################################################import functools@functools.lru_cache(maxsize=10**8)def f(x):s = set()if x >= 1: s.add(f(x-1))if x >= 2: s.add(f(x-2))for i in range(3):if i not in s:mex = i; breakreturn mex##########################################################################def xor_sum(A):ret = 0for a in A: ret ^= areturn ret##########################################################################from collections import CounterN = int(input())M = list(map(int,input().split()))prime = [prime_numbers(M[i]) for i in range(N)]grundy_1 = 0for i in range(N):grundy_2 = 0for j in Counter(prime[i]).values():grundy_2 ^= f(j)grundy_1 ^= grundy_2print("Alice") if grundy_1 else print("Bob")