In today's Round #449, I received a MLE verdict on C in system testing. At first, I thought it was because of how much stack space I allocated. But Java should allocate memory as necessary, and I was only using it for recursion, so I found it odd that I would MLE.
So, I resubmitted my code and made the following change:
That code was accepted. No change was made other than the addition of the comment. The two submissions are listed below for reference. MikeMirzayanov, what's good?
MLE: http://mirror.codeforces.com/contest/897/submission/32866893
AC: http://mirror.codeforces.com/contest/897/submission/32880052
what's even stranger is that you used even MORE memory in the code that got AC...
You know what they say, second time's the charm.
Just to be clear, literally submitting the exact same code from your in contest submission gets AC (http://mirror.codeforces.com/contest/897/submission/32880815) with 20248 KB of memory.
Interestingly, the in contest submission only uses 20140 KB on the test case it MLE's on, and uses 30316 KB on an earlier case. Maybe the exception returned wasn't really an MLE:
It looks to me like this is an exception returned when the OS won't allow the JVM to create any more threads (see https://stackoverflow.com/questions/16789288/java-lang-outofmemoryerror-unable-to-create-new-native-thread), yet you're only creating one extra thread (which is normally allowed). Maybe this is an issue with the server running your code being overloaded?
I'll look into it soon.
Thank you so much for updating the contest results to reflect the corrected submission. Your attention to community is awesome. Out of curiosity, did you figure out what the issue was? Was the above hypothesis correct?