Doubt in unordered_map vs map in C++

Правка en1, от RP_9, 2020-04-09 07:45:42

Hello Codeforces,

I was trying to solve Codeforces Round #632 (Div. 2) Problem C. It gave me TLE on the last case (87th case) when I used unordered_map (Link) while it was accepted when I used map (Link).

I know the worst-case time complexity of the unordered_map is O(n) for searching, insertion, and deletion. Is the last case the worst case? Could someone help me to figure out how this is happening or where I'm getting wrong?

Теги map vs unordered_map, c++, c++ 11, c++14, c++17

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский RP_9 2020-04-09 07:45:42 639 Initial revision (published)