Solution with unordered_map giving TLE gets accepted with ordered_map

Revision en1, by Infinite.Loop, 2021-02-17 10:06:42

This is my solution when I used unordered_map.

This is my solution when I used ordered_map.

It is seen that unordered_map performs better than ordered_map so how can TLE get resolved with ordered_map but not with unordered_map???

Tags #tle, #cpp, #std::map, map vs unordered_map

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Infinite.Loop 2021-02-17 10:06:42 426 Initial revision (published)