I was recently solving a problem using a vector first but I got MLE (memory limit exceeded). Then I declared an array of maximum size it got accepted in only 64 KiB. So if any of you know about how does memory limit get affected when we declare anything (large size) globally. And how does it affect the memory limit.
Code which got MLE — https://www.hackerearth.com/submission/41144649/ Code which got AC — https://www.hackerearth.com/submission/41145515/
If you provide your code it would be better for explaining.
I have added the code links
Auto comment: topic has been updated by Jim_Moriarty_ (previous revision, new revision, compare).
The only problem is that in your MLE solution you have used
struct of type long long
while in your accepted solutionthe array is of type int
(The memory is obviously reduced by half in this case).- I don't know how Memory verdict of Hackerearth works but your array
da[5000000][26]
took508804 KB
on Codeforces custom test, while on Hackerearth it shows only 64KiB. So i suggest you not to rely on Hackerearth Memory Verdict (idk how it works).Yeah! I thought same that something is wrong with the memory limit , because I was obviously using more than 64KiB.