結果
| 問題 |
No.3298 K-th Slime
|
| コンテスト | |
| ユーザー |
rinrion
|
| 提出日時 | 2025-10-09 17:23:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,174 bytes |
| コンパイル時間 | 3,841 ms |
| コンパイル使用メモリ | 227,800 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-09 17:24:04 |
| 合計ジャッジ時間 | 6,490 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 RE * 1 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vp = vector<pair<int, int>>;
#define rep(i, s, n) for (int i = s; i < (int)(n); i++)
#define sz(x) ((int)(x).size())
constexpr int INFI = 1001001001;
constexpr ll INFL = (1LL << 60);
int main (){
ios::sync_with_stdio(false);
cin.tie(nullptr);
// input
ll n, k, q;
cin >> n >> k >> q;
vl a (n);
priority_queue<ll> pqk;
priority_queue<ll, vector<ll>, greater<ll>> pqs;
rep(i, 0, n){
cin >> a[i];
}
sort (a.begin(), a.end());
rep (i, 0, k - 1){
pqk.push(a[i]);
}
rep (i, k - 1, n){
pqs.push(a[i]);
}
rep (i, 0, q){
int x;
cin >> x;
if(x == 1){
ll y;
cin >> y;
if(y >= pqk.top()) pqs.push(y);
else{
ll a = pqk.top();
pqk.pop();
pqk.push(y);
pqs.push(a);
}
}
else if(x == 2){
ll y;
cin >> y;
ll z = pqs.top();
pqs.pop();
pqs.push(y + z);
}
else{
if(sz(pqs) > 0) cout << pqs.top() << endl;
else cout << pqk.top() << endl;
}
}
return 0;
}
rinrion