結果
| 問題 | No.3298 K-th Slime |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-23 08:52:40 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 729 bytes |
| 記録 | |
| コンパイル時間 | 220 ms |
| コンパイル使用メモリ | 82,040 KB |
| 実行使用メモリ | 93,280 KB |
| 最終ジャッジ日時 | 2026-02-23 11:42:02 |
| 合計ジャッジ時間 | 7,139 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 20 RE * 5 |
ソースコード
import heapq
N,K,Q = map(int,input().split())
A = sorted(list(map(int,input().split())))
heap = A[2:]
B = A[:2]
for _ in range(Q):
qry = list(map(int,input().split()))
if len(qry)==1:
print(heap[0])
else:
if qry[0]==3:
print(heap[0])
elif 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)