harryb17's blog

By harryb17, history, 15 months ago, In English

In a recent codeforces contest round 892 question E(Maximum Monogonosity) I received a strange MLE on my solution which uses a 3D vector, but the same solution passed when I used a global declared 3D array. I know global declared arrays are faster than vectors and take slightly less size cause of the vector dynamic nature of doubling memory while using push_back. But none of this happened in the following code. can anyone please explain why this happened?

Note: No I didn't use any constant memory of vector for every test case, such that for 1e5 test cases it would fail.

my 3D array was n*k*5, where n & k are <= 3000. the constraints are tight and even while using globally declared array, it was 300Mb out of 512Mb, so that might give a hint why it might fail for vectors, but still, I think there might be a better reason.

Link to my:

Accepted Solution round 892 problem E

Memory Limit Exceeded Solution round 892 problem E

  • Vote: I like it
  • +5
  • Vote: I do not like it

| Write comment?
»
14 months ago, # |
  Vote: I like it 0 Vote: I do not like it
  • »
    »
    14 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thank you for the link bro!, great explanation