OSDN Git Service

:pencil2: fix SAM in seqam
authorouuan <1609483441@qq.com>
Sat, 14 Sep 2019 07:39:28 +0000 (15:39 +0800)
committerouuan <1609483441@qq.com>
Sat, 14 Sep 2019 07:39:28 +0000 (15:39 +0800)
docs/string/seq-automaton.md

index c39e01c..6330a3e 100644 (file)
@@ -78,6 +78,7 @@ $$
     
     void insert(int x) {
       int np = ++tot;
+      sam[np].len = sam[p].len + 1;
       while (p && !sam[p].ch[x]) {
         sam[p].ch[x] = np;
         p = sam[p].par;