Advertisement
ShafiulAzim

Untitled

Feb 5th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,i,j,n,p,a,c,x=0;
  6. string s;
  7. freopen("inp.txt","r",stdin);
  8. freopen("out.txt","w",stdout);
  9. priority_queue<int>pq;
  10. priority_queue<int>pq2;
  11. vector<int>v;
  12. string str,str1="DEQUEUE";
  13. while(1)
  14. {
  15. cin>>t;
  16. if(t==0)
  17. return 0;
  18. for(i=0; i<t; i++)
  19. {
  20. cin>>n;
  21. for(j=0; j<n; j++)
  22. {
  23. cin>>a;
  24. v.push_back(a);
  25. }
  26. }
  27. while(getline(cin,str))
  28. {
  29. if(str=="STOP")
  30. break;
  31. else if(str[0]=='E' && str[6]=='E')
  32. {
  33. c=(str.size()-1);
  34. s=str.substr(8,c);
  35. p= stoi(s);
  36. p=(-1)*p;
  37. pq.push(p);
  38.  
  39. }
  40. else if(str==str1)
  41. {
  42. pq2.push(pq.top());
  43. pq.pop();
  44. }
  45. }
  46. x++;
  47. cout<<"Scenario #"<<x<<endl;
  48. while(!pq2.empty()){
  49. cout<<(pq2.top()*(-1))<<endl;
  50. pq2.pop();
  51. }
  52. cout<<endl;
  53.  
  54. v.clear();
  55.  
  56.  
  57. }
  58. return 0;
  59. }
  60.  
  61. /*
  62. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement