You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following was >2x faster than std::unordered_map for https://codeforces.com/gym/103861/problem/B and the pbds hash map was also terrible (slow construction time? too much memory use?):
typedefuint64_t ull;
template<classT>
structHashMap {
int b;
vector<pair<ull, T>> v;
HashMap(int b) : b(b), v(1 << b) {}
T& operator[](ull x) {
ull y = x >> (64 - b), m = (1 << b) - 1;
while (v[y].first && v[y].first != x) ++y &= m;
v[y].first = x;
return v[y].second;
}
};
Maybe worth adding to KACTL instead of the pbds one?
The text was updated successfully, but these errors were encountered:
The following was >2x faster than std::unordered_map for https://codeforces.com/gym/103861/problem/B and the pbds hash map was also terrible (slow construction time? too much memory use?):
Maybe worth adding to KACTL instead of the pbds one?
The text was updated successfully, but these errors were encountered: