Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <set>
- #include <stdio.h>
- using namespace std;
- int main()
- {
- int n, x,j = 0;
- char c;
- cin >> n;
- multiset <int> a;
- for (int i = 0; i < 2 * n; i++)
- {
- cin >> c;
- if (c == '+'){
- scanf("%d", &x);
- a.insert(x);
- }
- if (c == '?'){
- printf("%d \n" , *a.begin());
- a.erase(a.begin());
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement