hdu 3065 AC自动机模版题

2014-11-24 01:18:38 · 作者: · 浏览: 2
题意:输出每个模式串出现的次数,查询的时候呢使用一个数组进行记录就好。
同上题一样的关键点,其他没什么难度了。
#include   
#include   
#include   
  
using namespace std;  
  
const int maxw = 1000 * 50 + 10;  
const int sigma_size = 128;  
const int maxl = 2000000 + 10;  
  
char str[1010][100];  
  
struct Trie{  
    int next[maxw][sigma_size],fail[maxw],end[maxw];  
    int root,L;  
    int newnode(){  
        for(int i=0;iQ;  
        fail[root]=root;  
        for(int i=0;i