結果
問題 |
No.2282 Boxed Nim
|
ユーザー |
![]() |
提出日時 | 2023-04-28 21:31:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,346 bytes |
コンパイル時間 | 109 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 23,252 KB |
最終ジャッジ日時 | 2024-11-17 20:30:54 |
合計ジャッジ時間 | 2,450 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 6 WA * 11 |
ソースコード
############################################################################################ 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 def cycle_detection(f, x0): power = lam = 1 first = x0 second = f(x0) while first != second: if power == lam: first = second power *= 2 lam = 0 second = f(second) lam += 1 first = second = x0 for i in range(lam): second = f(second) mu = 0 while first != second: first = f(first) second = f(second) mu += 1 return mu, lam def cycle_detection_lists(f, x0): mu, lam = cycle_detection(f, x0) before_cycle = [0] * mu if mu > 0: before_cycle[0] = x0 for i in range(mu - 1): before_cycle[i + 1] = f(before_cycle[i]) cycle = [0] * lam cycle[0] = before_cycle[-1] if mu > 0 else x0 for i in range(lam - 1): cycle[i + 1] = f(cycle[i]) return before_cycle, cycle import bisect,collections,copy,heapq,itertools,math,string,sys,queue,time,random from decimal import Decimal def I(): return input() def IS(): return input().split() def II(): return int(input()) def IIS(): return list(map(int,input().split())) def LIIS(): return list(map(int,input().split())) def comb(n, r):return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] INF=1<<63 MOD=998244353 MOD2=10**9+7 #sys.setrecursionlimit(10**7) alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ" def bit_count(x): return bin(x).count("1") def yesno(f): if f:print("Yes") else:print("No") #################################################### n=II() A=LIIS() for i in range(1,n): A[0]^=A[i] if A[0]==0: print("Second") else: print("First")