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

Автор KrK, 12 лет назад, По-английски

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.

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

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

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?

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

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