ac自动机膜板
Posted mzh2017
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ac自动机膜板相关的知识,希望对你有一定的参考价值。
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 typedef unsigned long long ULL; 5 #define MAXN 26 6 #define L 31 7 #define INF 1000000009 8 #define eps 0.00000001 9 struct node 10 { 11 node() 12 { 13 cnt = 0; 14 fail = NULL; 15 for (int i = 0; i < MAXN; i++) 16 next[i] = NULL; 17 } 18 int cnt; 19 struct node* next[MAXN]; 20 struct node* fail; 21 }; 22 typedef struct node* Tree; 23 void insert(Tree T, const char* str) 24 { 25 int p = 0; 26 Tree tmp = T; 27 while (str[p] != ‘