結果
| 問題 |
No.3298 K-th Slime
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-10 23:12:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 723 bytes |
| コンパイル時間 | 1,883 ms |
| コンパイル使用メモリ | 200,628 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-10 23:12:55 |
| 合計ジャッジ時間 | 7,216 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | AC * 5 RE * 20 |
コンパイルメッセージ
main.cpp: In lambda function:
main.cpp:23:9: warning: no return statement in function returning non-void [-Wreturn-type]
23 | };
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
int N, K, Q;
cin >> N >>K >> Q;
priority_queue<ll> pque1;
priority_queue<ll, std::vector<ll>, greater<ll>> pque2;
auto add = [&](ll x) -> void {
pque1.push(x);
if (pque1.size() > K) {
pque2.push(pque1.top());
pque1.pop();
}
};
auto ers = [&]() -> ll {
ll ret = pque1.top();
pque1.pop();
if (!pque2.empty()) {
pque1.push(pque2.top());
pque2.pop();
}
};
while (N--) {
ll a;
cin >> a;
add(a);
}
while (Q--) {
int t;
cin >> t;
if (t == 1) {
ll x;
cin >> x;
add(x);
} else if (t == 2) {
ll y;
cin >> y;
y += ers();
add(y);
} else {
cout << pque1.top() << endl;
}
}
}