結果
| 問題 | No.3298 K-th Slime | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-05 16:33:07 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 155 ms / 2,000 ms | 
| コード長 | 1,379 bytes | 
| コンパイル時間 | 4,866 ms | 
| コンパイル使用メモリ | 281,780 KB | 
| 実行使用メモリ | 12,928 KB | 
| 最終ジャッジ日時 | 2025-10-05 16:33:14 | 
| 合計ジャッジ時間 | 7,440 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 25 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
	return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
	return x < y ? (x = y, true) : false;
}
struct io_setup {
	io_setup() {
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		cout << fixed << setprecision(15);
	}
} io_setup;
using mint = atcoder::modint998244353;
// pbds tree
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
template <typename T>
using pbds_tree =
	__gnu_pbds::tree<T,
					 __gnu_pbds::null_type,
					 less<T>,
					 __gnu_pbds::rb_tree_tag,
					 __gnu_pbds::tree_order_statistics_node_update>;
void solve() {
	int n, k, q;
	cin >> n >> k >> q;
	k--;
	pbds_tree<pair<ll, int>> tr;
	int cnt = 0;
	rep(i, 0, n) {
		ll a;
		cin >> a;
		tr.insert({a, cnt++});
	}
	rep(Qi, 0, q) {
		int t;
		cin >> t;
		if (t == 1) {
			int x;
			cin >> x;
			tr.insert({x, cnt++});
		}
		if (t == 2) {
			int y;
			cin >> y;
			auto itr = tr.find_by_order(k);
			auto [sz, id] = *itr;
			tr.erase(itr);
			tr.insert({sz + y, id});
		}
		if (t == 3) {
			auto itr = tr.find_by_order(k);
			cout << itr->first << '\n';
		}
	}
}
int main() {
	int t = 1;
	// cin >> t;
	while (t--) solve();
}
            
            
            
        