結果
問題 |
No.2165 Let's Play Nim!
|
ユーザー |
![]() |
提出日時 | 2022-12-19 00:25:33 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 587 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 95,048 KB |
平均クエリ数 | 3.10 |
最終ジャッジ日時 | 2024-11-18 00:08:06 |
合計ジャッジ時間 | 7,188 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 RE * 36 |
ソースコード
from heapq import * n = int(input()) aa = list(map(int, input().split())) hp = [] x = 0 for i, a in enumerate(aa): x ^= a heappush(hp, (-a, i)) t = 1 if x else 0 print(t, flush=True) ret = 0 while ret == 0: if t: i = a = -1 while aa[i] != a: a, i = heappop(hp) a = -a b = x ^ a k = a-b print(i+1, k, flush=True) else: i, k = map(int, input().split()) i -= 1 a = aa[i] b = a-k x ^= a ^ b aa[i] = b if b: heappush(hp, (-b, i)) ret = int(input()) t ^= 1