calm_ankush's blog

By calm_ankush, 10 years ago, In English

Which algo should be used???? http://acm.timus.ru/problem.aspx?space=1&num=1220 problem is Memory limit exceeded here..

  • Vote: I like it
  • -11
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I m using stack[1001] stl here, but it shows memory limit exceeded...

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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.

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

try to submit under Visual C++ 2010 if you are using G++.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    is there any way to solve with standard C++ ??

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      I got AC half an hour ago with MS VS 2010 C++ compiler. The same code with G++ gets ML.