警示后人,如果你只有1分
查看原帖
警示后人,如果你只有1分
578829
wjyppm1403楼主2025/8/1 10:28

    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] 即可

2025/8/1 10:28
加载中...