iamits26ap's blog

By iamits26ap, history, 3 years ago, In English

I am a beginner on codeforces so don't know how to tackle this issue. https://codeforces.com/contest/356/submission/122771867 is the link to my submission for problem https://codeforces.com/contest/356/problem/A.

This gives a runtime error on test case 11. The checker LOG gives the following message: "Exit code is -1073741819" along with the message "Probably, the solution is executed with error 'out of bounds' on the line 8". Please tell me how to rectify this issue.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Most likely you are not assigning enough memory space in the declaration of tree array. To see this try n=6. You require an array of size atleast 13 but you are only allocating size 11. There is no harm in allocating a bit more space than you actually need, just allocate space twice of the smallest power of 2 that is larger than or equal to n, and out of bounds should be solved.