TLE when used maps (AUHASH)

This is the link to the question.
I got a TLE when using a map<pair<ll,pair<ll,ll>,ll> but got accepted when used a 3D Array.
Why so?
Here are the links:
https://www.codechef.com/viewsolution/33353346
https://www.codechef.com/viewsolution/33353009
Thank You in advance.

Accessing an element in an array can be done in constant time while it takes O(log N) in map

2 Likes

I have added the links, please see if O(log n) access is what leads to TLE or not?. The number of iterations is less than 1e7. So,I don’t think O(log n) access should do harm.