989's blog

By 989, history, 9 months ago, translation, In English

At yesterday's competition Div. 3, my solution to problem D crashed on the system test and gave the verdict: Memory limit exceeded on test 9, but when I sent the same code after the system test it passed!

Code that crashed on system testing — 247076528.

Code that passed after system testing — 247189952.

They are identical! It's very strange why this happened, because the limits are small and I was sure that my task would pass system testing.

  • Vote: I like it
  • -26
  • Vote: I do not like it

»
9 months ago, # |
  Vote: I like it +6 Vote: I do not like it

Your first loop to clear the array of vectors is wrong because you didn't subtract the character by 'A' -> You are accessing outside of it

If your program doesn't get runtime error by that then it still causes an undefined behavior and there would be a case where your vectors are never cleared, causing MLE

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I also got MLE on problem D even it was working fine on my IDE , I thought maybe it because of lots of map ds I used so I optimised the space complexity, then also it didn't work. Then I tried to debug using sample test cases on codeforces custom invocation and figured out the problem , so its better to test on codeforces custom invocation in such cases.