|
|
back to boardsend to the following address:tracy_wz@126.com just use vector<int> A[1001]; and you'll got AC:) I was wrong Edited by author 23.07.2006 13:55 You get memory limit in this way, not accepted :) I tried this, but MLE also #include <cstdio> #include <stack> #include <map> using namespace std; map<int,stack<int> > m; int i,n,a,b; char command[10]; void main(void) { scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s",command); if (command[1] == '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(); } } } It's better than vector<int> A[1001]; But anyway, I need to hold all data that is pushed in stack! long data[100001]; long top[1001]; unsigned char arr[12501*17]; I used this and some bitwise arithmetics to push 100000 integers into 17 bits each =) I use bitwise atithmetic in Pascal, but got MLE :( simple O(N^2) solution with some optimizations gets AC. |
|
|