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. And also, is there a way to speed up unordered_map? Here are both submissions:
AC — map: http://codeforces.net/contest/670/submission/17757996
TLE — unordered_map: http://codeforces.net/contest/670/submission/17730894