哈希表
cpp
//相当于unordered_map
__gnu_pbds::cc_hash_table<T1, T2> h;//拉链法,速度慢但不会被卡
__gnu_pbds::gp_hash_table<T1, T2> h;//探测法
//拉链法不会被卡哈希冲突,但探测法会cpp
//升级版unordered_map
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace __gnu_pbds;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
int operator()(int x) const { return x ^ RANDOM; }
};
typedef gp_hash_table<int, int, chash> hash_t;