Hi guys,
I got runtime error for this submission 6661686. I use gnu++ 0x, compiled no warnings, and ran correct answer for test case "ABACABA" on my machine. But sadly, I get runtime error when submit. This is my first post, and appreciate a lot for your kindly reply. Thanks.
Main must return 0. If return code is not zero checker mark it as Runtime error.
Wrong, if main does not return any value, it's defaulted to zero, which is required by C++ standard and do not cause RTE. Note that it holds for main only and not true for another functions.
Most runtime errors are caused by
(1)Illegally accessing memory (array out of bound, using wild pointers, etc)
(2)Stack overflow (Recursions go too deep, allocating a very large array on stack, etc)
(3)Arithmetic error (Divide/modulo by zero, etc)
If your code runs correctly on your machine, runtime error is most likely caused by (1).
Array index out of bounds. Use valgrind or its windows analog if you want to catch this type of errors: