回文自动机 马拉车 后缀自动机 后缀数组 AC自动机 EXKMP KMP 字典树 字符串匹配shiftand算法 字符串哈希
手写哈希
#include<bits/stdc++.h> using namespace std; struct Hash { static const int MOD = 1999997; static const int N = 1e6; int head[MOD + 10], nx[N], top; int hs[N], id[N]; void init() { memset(head, -1, sizeof head); top = 0; } void insert(int x, int y) { int k = x % MOD; hs[top] = x; id[top] = y; nx[top] = head[k]; head[k] = top++; } int find(int x) { int k = x % MOD; for (int i = head[k]; i != -1; i = nx[i]) { if (hs[i] == x) { return id[i]; } } return -1; } }hs; int main(){ } hash