Блог пользователя gigabuffoon

Автор gigabuffoon, история, 7 лет назад, По-английски

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://codeforces.me/contest/897/submission/32866893

AC: http://codeforces.me/contest/897/submission/32880052

  • Проголосовать: нравится
  • +58
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +17 Проголосовать: не нравится

what's even stranger is that you used even MORE memory in the code that got AC...

»
7 лет назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

You know what they say, second time's the charm.

»
7 лет назад, # |
Rev. 3   Проголосовать: нравится +16 Проголосовать: не нравится

Just to be clear, literally submitting the exact same code from your in contest submission gets AC (http://codeforces.me/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:

java.lang.OutOfMemoryError: unable to create new native thread
	at java.lang.Thread.start0(Native Method)
	at java.lang.Thread.start(Thread.java:717)
	at Main.main(Main.java:16)

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?

»
7 лет назад, # |
  Проголосовать: нравится +55 Проголосовать: не нравится

I'll look into it soon.

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится +12 Проголосовать: не нравится

    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?