結果
| 問題 | No.3120 Lower Nim |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-09-30 01:51:27 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 214 ms / 2,000 ms |
| + 3µs | |
| コード長 | 957 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 81,704 KB |
| 実行使用メモリ | 85,404 KB |
| 平均クエリ数 | 2685.91 |
| 最終ジャッジ日時 | 2026-09-30 01:51:43 |
| 合計ジャッジ時間 | 8,708 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 43 |
ソースコード
def op(idx, x):
print(idx+1, x)
def opJ():
idx, x = map(int, input().split())
return idx-1, x
N = int(input())
A = list(map(int, input().split()))
cnt = [0]*14
for a in A:
for i in range(14):
cnt[i] += a>>i & 1
turn = -1
if any(cnt[i]%2 == 1 for i in range(14)):
print("First")
turn = 0
else:
print("Second")
turn = 1
ret = 0
while ret == 0:
if turn == 0:
idx = -1
for i in range(14):
if cnt[i]%2 == 1:
idx = i
break
for i in range(N):
if 1<<idx <= A[i]:
op(i, 1<<idx)
A[i] -= 1<<idx
cnt[idx] -= 1
break
else:
idx, x = opJ()
for i in range(14):
if 1<<i & A[idx]:
cnt[i] -= 1
A[idx] -= x
for i in range(14):
if 1<<i & A[idx]:
cnt[i] += 1
ret = int(input())
turn ^= 1
detteiuu