标签:
Description
Input
Output
Sample Input
Sample Output
#include<stdio.h> #include<algorithm> #include<queue> #include<string> #include<string.h> #include<iostream> using namespace std; struct Node{ int yx; int id; bool operator <(const Node& t2)const{ if(yx!=t2.yx) return yx<t2.yx; return id>t2.id; } }; int main(){ int n; while((scanf("%d",&n))!=EOF){ priority_queue<Node>doc[4]; int id=1; Node tmp; for(int i=0;i<n;i++){ string op; cin>>op; if(op=="IN"){ int a,b; scanf("%d%d",&a,&b); tmp.yx=b; tmp.id=id; id++; doc[a].push(tmp); }else if(op=="OUT"){ int a; scanf("%d",&a); if(doc[a].empty()){ printf("EMPTY\n"); }else{ printf("%d\n",doc[a].top().id); doc[a].pop(); } } } } return 0; }
标签:
原文地址:http://www.cnblogs.com/superxuezhazha/p/5691362.html