标签:
1 #include<stdio.h> 2 #include<queue> 3 using namespace std; 4 struct node 5 { 6 int id; 7 int val; 8 friend bool operator< (node a,node b) 9 { 10 if(a.val!=b.val) 11 return a.val<b.val; 12 else 13 { 14 return a.id>b.id; 15 } 16 } 17 }; 18 int n; 19 int main() 20 { 21 int i,j; 22 char s[100]; 23 int num,set; 24 while(scanf("%d",&n)!=EOF) 25 { 26 num=1; 27 node temp; 28 priority_queue<node>q[5]; 29 for(i=1;i<=n;i++) 30 { 31 scanf("%s",s); 32 if(s[0]==‘I‘) 33 { 34 scanf("%d %d",&set,&temp.val); 35 temp.id=num++; 36 q[set].push(temp); 37 } 38 else 39 { 40 scanf("%d",&set); 41 if(q[set].empty()) 42 { 43 printf("EMPTY\n"); 44 continue; 45 } 46 node exm=q[set].top(); 47 q[set].pop(); 48 printf("%d\n",exm.id); 49 } 50 } 51 } 52 }
标签:
原文地址:http://www.cnblogs.com/sweat123/p/4558654.html