//ac自动机模板
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<queue>
using namespace std;
const int maxn=26;
char s[60],t[1000005];//母串子串
int ans;
struct node
{
struct node *son[maxn];//子节点
struct node *fail;
int num;
}*root;
//创建节点
node* create()
{
node *p;
p=(node*)malloc(sizeof(node));
for(int i=0;i<maxn;i++)p->son[i]=NULL;
p->num=0;
p->fail=NULL;
return p;
}
//插入母串,构建树
void insert()
{
node *p;
p=root;
int i=
AC自动机模板代码【可直接复制粘贴运行】
最新推荐文章于 2021-05-28 21:28:51 发布