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:
https://codeforces.net/blog/entry/119622
thank you for the link bro!, great explanation