|
|
вернуться в форумML10 - 0.9mb Послано Rayzor 8 ноя 2009 15:14 I tryed to minimize using of memory, but... #include <cstdio> #include <stack> #include <map> using namespace std; map<unsigned int,stack<unsigned int> > m; unsigned int n, i, b; unsigned short a; char c; void main(void) { scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%s",c,c);
if (c == 'U'){ scanf("%d %d\n",&a,&b); m[a].push(b); }else{ scanf("%d\n",&a); printf("%d\n",m[a].top()); m[a].pop(); } } } Re: ML10 - 0.9mb Hi, Don't use Maps and Stacks. They take too much memory. You need to try to solve this problem by just including <cstdio> library and nothing else. However, I still can't do it even though I am doing that and using dynamic arrays. I am getting MLE 12. Varun |
|
|