結果
| 問題 |
No.3120 Lower Nim
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-19 09:31:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 363 ms / 2,000 ms |
| コード長 | 944 bytes |
| コンパイル時間 | 626 ms |
| コンパイル使用メモリ | 82,576 KB |
| 実行使用メモリ | 95,176 KB |
| 平均クエリ数 | 2685.91 |
| 最終ジャッジ日時 | 2025-04-19 09:31:47 |
| 合計ジャッジ時間 | 13,360 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 43 |
ソースコード
def change(p,x):
now=A[p]
for i in range(15):
sms[i]-=now
now//=2
A[p]=x
now=x
for i in range(15):
sms[i]+=now
now//=2
N=int(input())
A=list(map(int,input().split()))
sms=[0]*15
for i in range(N):
now=A[i]
for j in range(15):
sms[j]+=now
now//=2
odd=False
for i in range(15):
if sms[i]%2==1:
odd=True
if odd:
print("First")
else:
print("Second")
i,s=map(int,input().split())
ret=int(input())
assert(ret!=-1)
i-=1
change(i,A[i]-s)
while True:
now=1
for i in range(15):
if sms[i]%2==1:
break
now*=2
for i in range(N):
if A[i]>=now:
change(i,A[i]-now)
print(i+1,now)
break
ret=int(input())
assert(ret!=-1)
if ret==1:
exit()
i,s=map(int,input().split())
ret=int(input())
assert(ret!=-1)
i-=1
change(i,A[i]-s)