进阶实验4-3.2 Windows消息队列 (25 分)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
char s[100100][20];
char a[20],b[20];
int main()
{
priority_queue<int,vector<int>,greater<int> > q;
int n;
scanf("%d",&n);
int x;
while(n--)
{
scanf("%s",a);
if(strcmp(a,"PUT")==0)
{
scanf("%s%d",b,&x);
strcpy(s[x],b);
q.push(x);
}
else
{
if(!q.empty())
{
printf("%s\n",s[q.top()]);
q.pop();
}
else
printf("EMPTY QUEUE!\n");
}
}
return 0;
}