結果
| 問題 | No.3298 K-th Slime |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-23 08:57:00 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 681 bytes |
| 記録 | |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,520 KB |
| 実行使用メモリ | 93,308 KB |
| 最終ジャッジ日時 | 2026-02-23 11:42:08 |
| 合計ジャッジ時間 | 6,178 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 19 RE * 1 |
ソースコード
import heapq
N,K,Q = map(int,input().split())
A = sorted(list(map(int,input().split())))
heap = A[K-1:]
B = A[:K]
for _ in range(Q):
qry = list(map(int,input().split()))
if len(qry)==1:
print(heap[0])
else:
if qry[0]==1:
x = qry[1]
if x>=B[-1]:
heapq.heappush(heap,x)
elif x>=B[0]:
y = B.pop()
B.append(x)
heapq.heappush(heap,y)
else:
y = B.pop()
B = [x,B[0]]
heapq.heappush(heap,y)
else:
y = qry[1]
x = heapq.heappop(heap)
heapq.heappush(heap,x+y)