Memory Limit Exceeded...Pls help!

Revision en2, by KarMa_, 2022-05-29 10:29:01

I have been solving 1354D - Multiset for quite a while now and am getting MLE on test case 8 ever since (7 attempts)!

Though I am using a single array of size n for the Tree because it has strict memory limit, I am confused how to optimize it further.

Here are my submissions:

  • Attempt 7 : 158777250 (tried making the tree array static...idk how that would help but still)

  • Attempt 3-6 : tried various combinations for getting the 1st element for final output/ removing some pre-declared arrays, methods/etc.

  • Attempt 2 : 158775164 (removed frequency array)

  • Attempt 1 : 158774360 (2 arrays : 1 for frequency and other for Tree)

How can this issue be resolved?

Thanks in advance! :)

Tags multiset, query, memory limit excceded

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English KarMa_ 2022-05-29 10:29:01 66 (published)
en1 English KarMa_ 2022-05-29 10:23:27 723 Initial revision (saved to drafts)