显然AC自动机,但什么叫无限生成呢?显然就是在AC自动机上匹配,出现了一个环(不能走结尾节点)直接搜索即可 ..,'] of longint; q,f:..] of longint; can,v,r:..] of boolean; l,n,i,t,j,k:longint; s:ansistring; procedure ac; var j,x,y,h,r:longint; c:char; begin h:=; r:=; ' do ,c]<> then begin inc(r); q[r]:=t…