How to improve performance of std::unordered_map

Правка en1, от AnotherRound, 2016-05-06 12:29:29

After getting TLE on test 132 for problem C on CF #350, I tried to optimise. I was surprised when I got AC, because the only thing I needed to change was to replace std::unordered_map with std::map. Does anyone have ideas what causes the different performance? I expected that unordered_map should be faster that map, but it is not the case. Here are both submissions:

AC — map: http://codeforces.net/contest/670/submission/17757996

TLE — unordered_map: http://codeforces.net/contest/670/submission/17730894

Теги map, unordered_map

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский AnotherRound 2016-05-06 12:33:26 52
en1 Английский AnotherRound 2016-05-06 12:29:29 575 Initial revision (published)