結果
問題 |
No.3298 K-th Slime
|
ユーザー |
![]() |
提出日時 | 2025-10-05 13:45:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 515 ms / 2,000 ms |
コード長 | 700 bytes |
コンパイル時間 | 278 ms |
コンパイル使用メモリ | 82,144 KB |
実行使用メモリ | 97,452 KB |
最終ジャッジ日時 | 2025-10-05 13:45:49 |
合計ジャッジ時間 | 7,413 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
N,K,Q=map(int,input().split()) A=list(map(int,input().split())) from heapq import heappush,heappop S0=[] S1=[] A.sort() for i in range(K): x=A[i] heappush(S0,-x) for i in range(K,N): x=A[i] heappush(S1,x) heappush(S1,10**18) for _ in range(Q): t,*B=map(int,input().split()) if t==1: y=B[0] x=heappop(S0) x=-x if y>x: heappush(S1,y) heappush(S0,-x) else: heappush(S1,x) heappush(S0,-y) elif t==2: k=B[0] x=heappop(S0) x=-x x+=k y=heappop(S1) if x>y: heappush(S1,x) heappush(S0,-y) else: heappush(S0,-x) heappush(S1,y) else: result=heappop(S0) print(-result) heappush(S0,result)