Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

framebassman's blog

By framebassman, history, 7 years ago, translation, In English

Hi there.

Recently I faced with judge system issue on Codeforces Round 392 (Div. 2). I submited solution during the contest and judge system informed me that my code was failed on tests: 23967230. I debugged my code and made sure that there is no errors. I submited this code again and lo and behold solution passed all tests: 24019202.

I think such things already happened. So what should I do in this case?

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

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

Protip : If judge system seems to behave weirdly, it's your fault.

In this case, your char array have only size 100, even it needs more than 101 sizes. (https://www.tutorialspoint.com/cprogramming/c_strings.htm) In result, your program will try to access s[100], which is undefined in standard C++ compiler.

What happens if you try undefined behavior in C++? Well, your program might crush, or calculate random stuffs, or print random stuffs, or turn your computer into a nuclear missile. All of these can be possible under C++ standard, and it's not a fault of compiler nor a grading system. https://en.wikipedia.org/wiki/Undefined_behavior