typedef unsigned long long ULL;
const int N = 100010, P = 131;
int n, m;
char str[N];
ULL h[N], p[N];
ULL get(int l, int r){
return h[r] - h[l - 1] * p[r - l + 1];
}
void run(){
p[0] = 1;
for(int i = 1; i <= n; i++){
p[i] = p[i - 1] * P;
h[i] = h[i - 1] * P + str[i];
}
}
hash简易板子
最新推荐文章于 2022-05-11 15:38:36 发布