Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,i,j,n,p,a,c,x=0;
- string s;
- freopen("inp.txt","r",stdin);
- freopen("out.txt","w",stdout);
- priority_queue<int>pq;
- priority_queue<int>pq2;
- vector<int>v;
- string str,str1="DEQUEUE";
- while(1)
- {
- cin>>t;
- if(t==0)
- return 0;
- for(i=0; i<t; i++)
- {
- cin>>n;
- for(j=0; j<n; j++)
- {
- cin>>a;
- v.push_back(a);
- }
- }
- while(getline(cin,str))
- {
- if(str=="STOP")
- break;
- else if(str[0]=='E' && str[6]=='E')
- {
- c=(str.size()-1);
- s=str.substr(8,c);
- p= stoi(s);
- p=(-1)*p;
- pq.push(p);
- }
- else if(str==str1)
- {
- pq2.push(pq.top());
- pq.pop();
- }
- }
- x++;
- cout<<"Scenario #"<<x<<endl;
- while(!pq2.empty()){
- cout<<(pq2.top()*(-1))<<endl;
- pq2.pop();
- }
- cout<<endl;
- v.clear();
- }
- return 0;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement