Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <set>
  4. #include <stdio.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n, x,j = 0;
  10. char c;
  11.  
  12. cin >> n;
  13. multiset <int> a;
  14. for (int i = 0; i < 2 * n; i++)
  15. {
  16. cin >> c;
  17. if (c == '+'){
  18. scanf("%d", &x);
  19. a.insert(x);
  20.  
  21. }
  22. if (c == '?'){
  23. printf("%d \n" , *a.begin());
  24. a.erase(a.begin());
  25.  
  26.  
  27. }
  28.  
  29.  
  30. }
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement