結果
問題 |
No.3298 K-th Slime
|
ユーザー |
![]() |
提出日時 | 2025-10-05 13:56:04 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 384 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 91,364 KB |
最終ジャッジ日時 | 2025-10-05 13:56:11 |
合計ジャッジ時間 | 6,938 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 RE * 1 |
ソースコード
import heapq n, k, q = map(int, input().split()) a = list(map(int, input().split())) hq = [] hq2 = [] for x in a: heapq.heappush(hq, x) if len(hq) > n - k + 1: heapq.heappush(hq2, -heapq.heappop(hq)) for _ in range(q): s = input() if s[0] == "1": _, x = map(int, s.split()) heapq.heappush(hq, x) if hq[0] < -hq2[0]: heapq.heappush(hq, -heapq.heappop(hq2)) heapq.heappush(hq2, -heapq.heappop(hq)) elif s[0] == "2": _, y = map(int, s.split()) heapq.heappush(hq, heapq.heappop(hq) + y) else: print(hq[0])