結果
| 問題 |
No.3120 Lower Nim
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-04-24 02:22:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,307 bytes |
| コンパイル時間 | 337 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 27,520 KB |
| 平均クエリ数 | 0.80 |
| 最終ジャッジ日時 | 2025-04-24 02:22:56 |
| 合計ジャッジ時間 | 4,696 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | AC * 5 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()
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
break
tind=-1
for ind in LIST:
if A[ind]>=tx:
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)
titia