3 solutions

  • 0
    @ 2022-3-31 19:32:48
    #include<bits/stdc++.h>
    using namespace std;
    int t,x;
    int main(){
    	std::ios::sync_with_stdio(false);
    	cin>>t;
    	priority_queue <int> num;
    	string st;
    	while(t--){
    		cin>>st;
    		if(st=="push"){
    			cin>>x;
    			num.push(x);
    		}else{
    			if(num.empty())
    				cout<<"Empty"<<endl;
    			else{
    				cout<<num.top()<<endl;
    				num.pop();
                }
    		}
    	}
    	return 0;
    }
    

    Information

    ID
    332
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    51
    Accepted
    16
    Uploaded By