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;
- scanf("%d",&n);
- priority_queue <int> pq;
- for(int i=0;i<n;i++){
- char a;
- scanf(" %c",&a);
- if(a=='P'){
- int x;
- scanf("%d",&x);
- pq.push(x);
- }
- else {
- if(pq.empty()) printf("-1");
- else{
- printf("%d",pq.top());
- pq.pop();
- }
- printf("\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement