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

Автор Jim_Moriarty_, история, 5 лет назад, По-английски

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/

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

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

If you provide your code it would be better for explaining.

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

Auto comment: topic has been updated by Jim_Moriarty_ (previous revision, new revision, compare).

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

The only problem is that in your MLE solution you have used struct of type long long while in your accepted solution the 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] took 508804 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).

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    Yeah! I thought same that something is wrong with the memory limit , because I was obviously using more than 64KiB.