#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;
struct node
{
char name[1000];
int num;
int value;
int id;
bool friend operator<(node x,node y)
{
if(x.value!=y.value)
return x.value>y.value;
else
return x.id>y.id;
}
};
node stu[60050];
int main()
{
char op[30];
int sum=0;
node xx;
priority_queue<node>p;
while(~scanf("%s",op))
{
if(strcmp(op,"GET")==0)
{
if(p.empty())
{
printf("EMPTY QUEUE!\n");
}
else
{
xx=p.top();
p.pop();
printf("%s %d\n",xx.name,xx.num);
}
}
else
{
scanf("%s %d %d",xx.name,&xx.num,&xx.value);
xx.id=sum++;
p.push(xx);
}
}
return 0;
}
01-17
07-10
942
05-24
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交