結果
| 問題 |
No.3298 K-th Slime
|
| コンテスト | |
| ユーザー |
くらげ
|
| 提出日時 | 2025-08-29 16:57:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 881 bytes |
| コンパイル時間 | 5,209 ms |
| コンパイル使用メモリ | 221,736 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-09-12 01:52:15 |
| 合計ジャッジ時間 | 7,532 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n,k,que;
cin >> n >> k >> que;
assert(1<=k&&k<=n&&n<=100000);
assert(1<=que&&que<=100000);
vector<ll> a(n);
rep(i,n){
cin >> a[i];
assert(1<=a[i]&&a[i]<=1000000000);
}
sort(a.begin(),a.end());
priority_queue<ll,vector<ll>,greater<ll>> q;
for(int i=k-1;i<n;i++) q.push(a[i]);
while(que--){
int t;
cin >> t;
assert(1<=t&&t<=3);
if(t==1){
int x;
cin >> x;
assert(1<=x&&x<=1000000000);
q.push(x);
}
if(t==2){
int y;
cin >> y;
assert(1<=y&&y<=1000000000);
q.push(q.top()+y);
q.pop();
}
if(t==3) cout << q.top() << "\n";
}
}
くらげ