Memory limit exceeded although using much less

Правка en1, от SomethingIrrelevant, 2020-06-05 15:24:49

So, I'm trying to solve the Multiset problem (https://codeforces.net/contest/1354/problem/D).

The memory limit is:

but then I get a MLE although I'm only using 19MB (far from 28MB).

What's the rationale behind this?

My code only uses the following data:

        int n2 = 1048576;
        int[] actualArray = new int[2 * n2];

so it should be about (2 * 1048576) * 4 bytes ~= 8MB. So, again, I'm far from 19MB. Any ideas why I get MLE?

The idea of my algorithm (https://codeforces.net/contest/1354/submission/82629303) is to use a segment tree. Where every leaf correspond to values from 1 to 10^6 (maximum n) and a leaf i contains how many times a value i exists in the initial array. Then, we sum up the leaves, etc.

Теги memory limit excceded

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский SomethingIrrelevant 2020-06-05 15:24:49 887 Initial revision (published)