#include<iostream>
#include<queue>
#include<string>
using namespace std;
struct node
{
int weight;
int parameter;
string name;
bool friend operator < (node a,node b)
{
return a.weight>b.weight;
}
};
int main()
{
priority_queue<node> que;
string str;
while(cin>>str)
{
if(str=="GET")
if(que.empty())
cout<<"EMPTY QUEUE!"<<endl;
else
{
node temp;
temp=que.top();
que.pop();
cout<<temp.name<<' '<<temp.parameter<<endl;
}
else
{
node temp;
cin>>temp.name>>temp.parameter>>temp.weight;
que.push(temp);
}
}
return 0;
}
zoj2724-Windows Message Queue
最新推荐文章于 2020-03-04 18:21:17 发布