#include<cstring>
#include<iostream>
#include<queue>
#include<cstdio>
using namespace std;
struct Message
{
char Name[100];
int Date;
int Priority;
bool operator <(const Message &a)const
{
return a.Priority<Priority;
}
};
priority_queue<Message>v;
int main()
{
char command[100];
Message message;
while(scanf("%s",command)!=EOF)
{
if(strcmp(command,"GET")==0)
{
if(v.size()==0)
printf("EMPTY QUEUE!\n");
else
{
printf("%s %d\n",v.top().Name,v.top().Date);
v.pop();
}
}
else if(strcmp(command,"PUT")==0)
{
scanf("%s%d%d",&message.Name,&message.Date,&message.Priority);
v.push(message);
}
}
//system("pause");
return 0;
}
ZOJ 2724Windows Message Queue
最新推荐文章于 2021-01-29 20:44:45 发布