Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n , option , x;
- cin >> n;
- stack<int> s;
- multiset<int> m;
- while(n--){
- cin >> option;
- if(option == 1){
- cin >> x;
- s.push(x);
- m.insert(x);
- continue;
- }
- if(option == 2){
- m.erase(m.find(s.top()));
- s.pop();
- continue;
- }
- cout << *(m.begin()) << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement