rofi93's blog

By rofi93, 9 years ago, In English

In this problem 459B - Pashmak and Flowers range of n is 2*10^5 and i mistakenly declared the array of size 1*10^5. For this mistake i should have been given RE (Runtime Error), but instead why i was given TLE (Time Limit Exceeded) ? It took me a long time to figure out the bug because of weird verdict !! check my submissions- 13244700 and 13244705

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

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

Here is a "best friend" of C++ programmer — undefined behavior(UB). This is what happens when you try to access index out of bounds. C++ does not offer tool to check range of indexes in bare arrays.

It is what it sounds like — what happens is undefined. It can work properly(often when you access less than +20 elements or so), it can cause freeze of program, it can be anything. In your case it caused TLE.

I advise you to read more on undefined behavior and what can invoke it.