void insert(int c,int id){ int p=getfail(lst,id); // .... else{ int hp=half[p]; while(st[p-len[hp]-1]!=st[p]||(len[hp]+2<<1)>len[tot]){ hp=fail[hp]; } half[tot]=nxt[hp][c]; } } }
st[p-len[hp]-1]!=st[p] 是不对的,改为 st[id-len[hp]-1]!=st[id] 即可
st[p-len[hp]-1]!=st[p]
st[id-len[hp]-1]!=st[id]