ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1220. Stacks

Please help.MLE#10.Thank!
Posted by CHIDEMYAN SERGEY 10 Nov 2007 22:38
#include<iostream>
using namespace std;
#include<stack>
#include<vector>
int main()
{
    std::stack<int,std::vector<int> >val[1001];
    int k,i=0,n,m;
    cin>>k;
    char a[4];
    while(i<k)
    {
        cin>>a;
        if(a[1]=='U')
        {
            cin>>n>>m;
            val[n].push(m);
        }
else
            if(a[1]=='O')
            {
                cin>>n;
                cout<<val[n].top()<<endl;
                val[n].pop();
            }
            i++;
    }



            return 0;
}
Any idea how to optimize?Please help!
Thank!


Edited by author 10.11.2007 23:02