Why does map work better than unordered_map?

Правка en1, от kshitij_coder, 2020-07-07 17:53:06

I was trying to solve the question B2 — Social Network (hard version). Question Link: https://codeforces.me/contest/1234/problem/B2

I first tried to code the solution using queue and unordered_map. But that gave me TLE. But when I used a map in place of unordered_map, the solution got accepted. Unordered_map does not keep the keys in a sorted format. Then why did an implementation using maps work better? Please guide me on this.

Thanks in advance!!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский kshitij_coder 2020-07-07 17:53:06 516 Initial revision (published)