题目要求FIFO
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<queue>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;
struct in
{
string name;
int id;
int dex;
in(string s,int d,int x):name(s),id(d), dex(x) { };
};
bool operator < (const in a,const in b)
{
return a.dex>b.dex;
}
priority_queue< in > q;
int main()
{
string S;
int Id,Dex;
while(cin>>S)
{
if(S=="GET"){
if(q.empty()) cout<<"EMPTY QUEUE!"<<endl;
else {
in t=q.top();q.pop();
cout<<t.name<<" "<<t.id<<endl;
}
}
else {
cin>>S>>Id>>Dex;
q.push(in(S,Id,Dex));
}
}
return 0;
}