On task 977F - Последовательная подпоследовательность I have a TL on solution with unordered_map 37945413 but exactly the same solution with map instead of unordered_map 37989920 I have passed. This is not an error because unordered_map faster map, right?
UPD: I just translated to Eng
UPD1:
Everything about unordered_map:
Why so much dislikes?
what's the point, considering you solved it for yourself and english speakers won't see russian comments?
Oh shit...
Actually, I found a new cool blog.
Good amount of discussion on this same topic can be found here. Read all comments.
Oh) thank you!
The worst case time complexity of operation in unordered_map is O(n) rather than the expected O(1),moreover the complexity of unordered_map is amortised O(1) ,whereas for map is O(log n). Similar thing had happened to me earlier.
In which cases, unordered_map works O(N)? Could tell me about this?
Sorry,I don't know any specific case as such. But I am sure there are set of test cases which can make them happen everytime as the hash function which unordered_map uses is known ans thus the cases which produces more and more collisions are bound to produce TLE verdict.
https://codeforces.net/blog/entry/62393
Thank you for awesome blog!