結果
| 問題 |
No.3298 K-th Slime
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 14:18:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 666 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 82,728 KB |
| 実行使用メモリ | 92,928 KB |
| 最終ジャッジ日時 | 2025-10-05 14:18:52 |
| 合計ジャッジ時間 | 6,636 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 RE * 4 |
ソースコード
import heapq
import bisect
N, K, Q = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ftK = A[: K]
atK = A[K:]
heapq.heapify(atK)
for i in range(Q):
query = list(map(int, input().split()))
if query[0] == 1:
if query[1] >= ftK[-1]:
heapq.heappush(atK, query[1])
else:
heapq.heappush(atK, ftK.pop())
bisect.insort_left(ftK, query[1])
elif query[0] == 2:
slim = ftK.pop() + query[1]
target = heapq.heappop(atK)
if slim <= target:
ftK.append(slim)
heapq.heappush(atK, target)
else:
ftK.append(target)
heapq.heappush(atK, slim)
else:
print(ftK[-1])