后缀自动机(SAM) 为了方便,我们做出如下约定: "后缀自动机" (Suffix Automaton) 在后文中简称为 SAM . 记 \(|S|\) 为字符串 \(S\) 的长度. 记 \(\sum\) 为字符集,记 \(|\sum|\) 为字符集大小. 关于 SAM 的复杂度证明在 OI Wiki 上已经很全面了,这里只是希望可以帮助大家理解 SAM 是如何工作的以及一些应用,对这些不再多做证明. 在前几个部分中,你只需要跟着笔者给出的构建好的 SAM 图理解某些定义,不需要知道…
1811. Longest Common Substring Problem code: LCS A string is finite sequence of characters over a non-empty finite set Σ. In this problem, Σ is the set of lowercase letters. Substring, also called factor, is a consecutive sequence of characters occur…