Codeforces will not be available in the period 01:00-05:00 May, 30 (MSK, UTC +3) because of maintenance. ×

conquizztador's blog

By conquizztador, history, 7 weeks ago, In English,

In the latest rated contest i.e., Codeforces Round #632 (Div. 2)

I submitted a solution for question B, Contest link wherein I had declared arrays globally with a size 10^4+10 instead of 10^5+10 and it gave TLE on pretest 3. Here's the link to my submission

However, on submitting the same code with GNU C++14 and GNU C++17, I got the much expected result RE. Here's the link to the RE one

Can anyone explain as to why this happened?

Also, I would like MikeMirzayanov to look into this.

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

»
7 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Accessing an out-of-bounds index is undefined behavior. Compilers assume it never happens so if it does happen you get all sorts of weird crap. C++ assumes you know what you're doing unlike other languages such as Java and won't do a lot of error checking for you.