結果

問題 No.3298 K-th Slime
ユーザー akira2004421
提出日時 2025-10-05 14:25:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 91,156 KB
最終ジャッジ日時 2025-10-05 14:25:56
合計ジャッジ時間 6,401 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 17 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
n,k,q=list(map(int,input().split()))
a=list(map(int,input().split()))
heapq.heapify(a)
front=a[:k-1]
back=a[k-1:]
for i in range(q):
    f,*x=list(map(int,input().split()))
    # print(front)
    # print(back)
    if f==1:
        if x[0]>front[-1]:
            heapq.heappush(back,x[0])
        else:
            heapq.heappush(back,front.pop())
            front.append(x[0])
    if f==2:
        y=heapq.heappop(back)
        x=x[0]+y
        if x>front[-1]:
            heapq.heappush(back,x)
        else:
            heapq.heappush(back,front.pop())
            front.append(x)
    if f==3:
        print(back[0])
0