結果
問題 |
No.3120 Lower Nim
|
ユーザー |
![]() |
提出日時 | 2025-04-24 02:19:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,243 bytes |
コンパイル時間 | 491 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 28,416 KB |
平均クエリ数 | 0.52 |
最終ジャッジ日時 | 2025-04-24 02:20:02 |
合計ジャッジ時間 | 6,150 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | AC * 2 RE * 3 TLE * 1 -- * 37 |
ソースコード
import sys input = sys.stdin.readline N=int(input()) A=list(map(int,input().split())) flag=0 K=1<<63 if N==1: flag=1 for i in range(30): x=1<<i S=0 for a in A: S+=a//x if S%2==1: flag=1 if flag: print("First",flush=True) else: print("Second",flush=True) i,x=map(int,input().split()) ret=int(input()) if ret==-1: exit() A[i-1]-=x K=min(K,x) LIST=set() for i in range(N): if A[i]!=0: LIST.add(i) while True: if len(LIST)==1 and K==1<<63: ind=LIST.pop() print(ind+1,A[ind],flush=True) ret=int(input()) if ret!=0: exit() tind=-1 for i in range(1<<30): x=1<<i S=0 for ind in LIST: S+=A[ind]//x if S%2==1: tx=x tind=ind break print(tind+1,tx,flush=True) ret=int(input()) if ret!=0: exit() A[tind]-=tx if A[tind]==0: LIST.remove(tind) K=min(K,tx) i,x=map(int,input().split()) ret=int(input()) if ret==-1: exit() A[i-1]-=x if A[i-1]==0: LIST.remove(i-1) K=min(K,x)