标签:ott std miss using accept friend 排队 测试 else
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9083 Accepted Submission(s): 3848
1 #include<iostream> 2 #include<functional> 3 #include<queue> 4 #include<cstring> 5 6 using namespace std; 7 8 int n; 9 struct node 10 { 11 friend bool operator < (node a,node b) 12 { 13 if(a.pri==b.pri) 14 return a.id>b.id; 15 else 16 return a.pri<b.pri; 17 } 18 int pri; 19 int id; 20 }; 21 int main() 22 { 23 while(cin>>n) 24 { 25 priority_queue<node>p[4]; 26 char shi[10]; 27 int pos=0,a,b; 28 for(int i = 0; i < n; i++) 29 { 30 node peo; 31 cin>>shi; 32 if(!strcmp(shi,"IN")) 33 { 34 cin>>a>>peo.pri; 35 pos++; 36 peo.id=pos; 37 p[a].push(peo); 38 } 39 else 40 { 41 cin>>a; 42 if(!p[a].empty()) 43 { 44 peo = p[a].top(); 45 p[a].pop(); 46 cout<<peo.id<<endl; 47 } 48 else 49 cout<<"EMPTY"<<endl; 50 } 51 } 52 } 53 return 0; 54 }
标签:ott std miss using accept friend 排队 测试 else
原文地址:http://www.cnblogs.com/Xycdada/p/6545648.html