转载:AcWing 4412. 构造数组 custom_hash
利用时间戳的hash函数,反卡
struct custom_hash {
static int splitmix64(int x) {
x ^= x << 13;
x ^= x >> 7;
x ^= x << 17;
return x;
}
size_t operator () (int x) const {
static const int FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); // 时间戳
return splitmix64(x + FIXED_RANDOM);
}
};
unordered_map<int,int, custom_hash>L,R;