ac自动机模板题
链表写法:
1 #include<iostream> 2 #include<stdio.h> 3 #include <string.h> 4 using namespace std; 5 6 #define T_size 1000000 7 #define P_size 50 8 #define Total_p 10000 9 10 struct trie 11 { 12 trie *next[26]; 13 trie *fail; 14 int num; 15 trie() 16 { 17 for(int i=0; i<26; i++) 18 { 19 next[i]=NULL; 20 } 21 fail=NULL; 22 num=0; 23 } 24 }; 25 26 char T[T_size+1]; 27 char P[P_size+1]; 28 trie* q[Total_p*P_size]; 29 30 void insert(trie *root,char *s) 31 { 32 trie*p=root; 33 for(int i=0; s[i]!='