#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
int n,y;
struct ele{
string s;
int x;
bool operator<(const ele &a)const{
return x>a.x;
}
};
int main()
{
cin>>n;
string s1,s2;
priority_queue<ele>q;
for(int i=1;i<=n;i++)
{
cin>>s1;
if(s1=="PUT")
{
cin>>s2>>y;
q.push({s2,y});
}
else{
if(!q.empty())
{
ele e=q.top();
q.pop();
cout<<e.s<<endl;
}
else
cout<<"EMPTY QUEUE!"<<endl;
}
}
return 0;
}
7-19 Windows消息队列
最新推荐文章于 2024-08-30 21:09:25 发布