About this behaviour on codeforces compiler

Revision en1, by py_cpp_js, 2020-07-07 00:19:02

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

So I was solving this question 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!

Tags #c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English py_cpp_js 2020-07-09 20:21:53 13 Tiny change: 'ing this [question](https://' -> 'ing this [problem](https://'
en2 English py_cpp_js 2020-07-07 11:22:54 1 Tiny change: 'Greeting codeforce' -> 'Greetings codeforce'
en1 English py_cpp_js 2020-07-07 00:19:02 794 Initial revision (published)