結果
問題 |
No.3298 K-th Slime
|
ユーザー |
![]() |
提出日時 | 2025-10-05 14:24:55 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,150 bytes |
コンパイル時間 | 5,353 ms |
コンパイル使用メモリ | 334,372 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-10-05 14:25:07 |
合計ジャッジ時間 | 7,095 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; using mint = modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, K, Q; cin >> N >> K >> Q; vector<int> A(N); for(int i = 0; i < N; i++) { cin >> A[i]; } sort(A.begin(), A.end()); priority_queue<int> low; priority_queue<int, vector<int>, greater<int>> high; for(int i = 0; i < N; i++) { if(i < K) low.push(A[i]); else high.push(A[i]); } while(Q--) { int t; cin >> t; if(t == 1) { ll x; cin >> x; low.push(x); high.push(low.top()); low.pop(); }else if(t == 2) { ll y; cin >> y; ll x = low.top(); low.pop(); if(!high.empty()) { low.push(high.top()); high.pop(); } low.push(x + y); high.push(low.top()); low.pop(); }else { cout << low.top() << "\n"; } } }