Which algo should be used???? http://acm.timus.ru/problem.aspx?space=1&num=1220 problem is Memory limit exceeded here..
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
Which algo should be used???? http://acm.timus.ru/problem.aspx?space=1&num=1220 problem is Memory limit exceeded here..
| Name |
|---|



I haven't tried to solve it myself. Could you please elaborate more on what's your approach to see if we can point you in the right direction?
I m using stack[1001] stl here, but it shows memory limit exceeded...
stl stack (std::stack) uses too much memory. You should organize your own stack. I used my own linked lists. Eech node of the list contain 0..7 elements.
try to submit under Visual C++ 2010 if you are using G++.
is there any way to solve with standard C++ ??
I got AC half an hour ago with MS VS 2010 C++ compiler. The same code with G++ gets ML.