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.
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?
Hi! Use files(input.txt/output.txt) for input/output.
It works. Thank you :)
Just need a more optimal algorithm