Getting TLE on using unordered_map, while AC on using map for problem E. Can anyone explain why??(I think unordered_map should be faster than map because its time complexity is O(1) for all operation.)
Link for Problem 1077E
Link for TLE Solution
Link for AC Solution
Auto comment: topic has been updated by gjaiswal108 (previous revision, new revision, compare).
Check this post
Thanks a lot. It worked now.
I tried custom_hash in a problem, then it gave tle for some cases while, without custom_hash, it did not why? alimq
I think unordered_map should be faster than map because its time complexity is O(1) for all operation.
Whoever told you this didn't do a good job. Please. Learn some proper Computer Science.
Thanks, I got to learn this now. I hv read it on geeksforgeeks, but didn't notice that it's average time complexity. There was not mentioned the worst case time complexity. (PS: I'm a beginner and learning.)
Please. Get yourself as far away from geeksforgeeks as you can. Their stuff is trashy. If you wanna learn, learn from academic papers/lectures. Even wikipedia is better than geeksforgeeks.
Thanks for your suggestion. You came to save my life from reading shitty post and making more mistake like this from now onwards.