py_cpp_js's blog

By py_cpp_js, history, 4 years ago, In English

Greetings codeforces community! hope you all are doing well :)

So I was solving this problem and I stumbled upon quite a peculiar bug, here are two of my submissions : submission 1 and submission 2, the first one gives RE while the second one passes all test cases.

The only difference between the two is that I declared an array named dp inside main function in the first one where as in the second one it was declared in global scope. I don't really get how this makes any difference in the solution, it would be nice if someone could shed some light on this. Thanks!

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it