結果
問題 |
No.649 ここでちょっとQK!
|
ユーザー |
![]() |
提出日時 | 2023-05-31 10:39:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 156 ms / 3,000 ms |
コード長 | 1,144 bytes |
コンパイル時間 | 4,970 ms |
コンパイル使用メモリ | 279,052 KB |
最終ジャッジ日時 | 2025-02-13 17:04:35 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using P = pair<ll, ll>; using mint = modint998244353; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tag_and_trait.hpp> using namespace __gnu_pbds; // using Tree = tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>; // set using Tree = tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>; // multiset #define rep(i, a, b) for(ll i = a; i < b; i++) #define rrep(i, a, b) for(ll i = a; i >= b; i--) constexpr ll inf = 4e18; int main(void) { cin.tie(0); ios::sync_with_stdio(0); ll q, k; cin >> q >> k; Tree st; while(q--) { ll t; cin >> t; if(t == 1) { ll v; cin >> v; st.insert(v); } else { auto itr = st.find_by_order(k - 1); if(itr == st.end()) { cout << -1 << '\n'; } else { cout << *itr << '\n'; st.erase(itr); } } } }