Hey everyone!
I encountered a very strange RE today on 1270F - Awesome Substrings.
In short, the problem involved creating a very very big array of ~6*10^7 integers. This submission gets accepted: 120032721, whereas this REs on test case 1: 120032550
The only difference in my accepted solution was updating MX to a slightly smaller value (350 -> 300) (and correspondingly updating MX2 to a slightly larger one) so that the very big array became smaller.
My theory is that the big array in the failing solution uses up more than 256MB, and exceeds the stack size of the machine... Except that the memory limit in the problem is 512MB and so that shouldn't be a problem :/
The idea that you can't submit something and be pretty certain that it passes just drives me nuts. Any thoughts?
According to https://codeforces.net/blog/entry/79 blog, GCC is used with
-Wl,--stack=268435456
option. Which increases the stack size limit to 256M, up from a rather small default.The 512M memory limit for that particular problem is there for the combined stack+heap size. The stack is still limited to 256M regardless. Moreover, you are very much lucky and privileged as a C++ user. Many of the other programming languages on the codeforces platform have ridiculously small stack sizes, which makes implementing deep recursive algorithms difficult.
Sweet, thanks! Also C++ supremacy wooo