Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- priority_queue<long long int> pq;
- int n;
- long long int m;
- char c;
- cin >> n;
- while(n--){
- scanf(" %c",&c);
- if(c=='P'){
- scanf("%lld",&m);
- pq.push(m);
- }else{
- if(pq.empty()) printf("-1\n");
- else{
- printf("%d\n",pq.top());
- pq.pop();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement