The kth great number
///@author Sycamore ///@date 8/8/2017 #include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; while (cin >> n >> k) { char ch; int t; multiset<int>s; while (n--) { cin >> ch; if (ch == ‘I‘) { cin >> t; s.insert(t); if (s.size() > k)s.erase(s.begin()); } else cout <<*s.begin()<<endl ; } } return 0; }
时间: 2024-10-07 06:29:38