Hi!
I thought that unordered_set is faster than set, because set complexity is logarithmic in size and unordered_set complexity is constant time in average.(source: cplusplus.com)
But today I saw this:
TLE(>2000 MS) with unordered_set: 15494816
Accepted(155 MS) with set: 15494846
Also my other solution(witch I submitted during the contest) with unordered_map hacked :'(
Now my question is : Is unordered_set faster than set?
UPD: I have accepted(15497282).unordered_set time was better than set(15494846) : 93<155.
Only with adding this line:s.max_load_factor(0.25);s.reserve(500);.
UPD2: it seems that it is better to use a power of 2 in reserve(i.e. s.reserve(512)).(Thanks from keyvankhademi)










