problem:- https://mirror.codeforces.com/contest/1996/problem/C
I was solving the above problem using C++ vector of maps and i got memory limit exceeded. But I solved the same problem with the same logic using vectors of vector and got accepted solution .I am unable to understand why the solution using maps failed.
Solution using maps:- https://mirror.codeforces.com/contest/1996/submission/273021146
Solution using vectors of vector:- https://mirror.codeforces.com/contest/1996/submission/273020910
Can someone expalin?