KrK's blog

By KrK, 11 years ago, In English

Good evening,

I am trying to solve a problem Torcoder.

Here is my code.

I submit it and I get MLE (which is 256 mb).

It is quite strange since the biggest amount of memory is used with the array "int freq[524288][26]". And it is 52 mb.

However, when I run the same code with the same test in "Custom test", I get the right result:

abacaba

===== Used: 0 ms, 55404 KB

What's the difference? How could I fix that?

Thank you.

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

»
11 years ago, # |
Rev. 7   Vote: I like it -20 Vote: I do not like it

offtopic:

// reads the suprised 'How?' title and expects a 10-line main() function which gets ML caused by special C++ features which are often unknown

// opens the pastebin.com link. whoops — a lot of code.

// 2:50 AM — AINT NOBODY GOT TIME FOR THAT

now serious:

Have you tried to test your code for ML just sending that array allocation without anything else?

»
11 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Hi! Use files(input.txt/output.txt) for input/output.