Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Why? Why? Why?

Правка en2, от rranaut07, 2023-11-22 12:06:32

There is something interesting I notice in Codeforces Round 909(Div 3). In D question I got TLE in 20th test case because I took Unordered Map instead of Map because as the number of enteries increase unordered map start experiencing collision Right. But I seen some code who take unordered_map<double, int> that run absolutely fine. I have 2 doubts.

  1. why unordered_map<double, int> work but unordered_map<int, int> didn't work. Is There some another hash function algorithm work in double?

  2. As number of entries are low then both map and unordered map work. But as the entries are high unordered map gives TLE. So, is it okay if I use every time map in every question and not use unordered map or there is some case where unordered map is preferred over map.

Теги unorder

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский rranaut07 2023-11-22 12:06:32 19
en1 Английский rranaut07 2023-11-20 10:50:36 792 Initial revision (published)