Блог пользователя rofi93

Автор rofi93, 9 лет назад, По-английски

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

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

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.