摘要: AC 自动机 AC 自动机 (Aho Corasick Automation) 是一个多模式字符串匹配算法. 定义 $fail$ 函数为该状态 (节点) 代表的字符串的 最长后缀 所在的状态. 特别的, 如果不存在这样的状态, $fail$ 函数设为根. 为了提高构建和匹配的效率, 在建立 trie 阅读全文
posted @ 2018-10-29 20:10 Ubospica 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 左偏树 用途 支持$O(\log n)$合并,$O(\log n)$删除堆顶,$O(\log n)$查找,$O(1)$取最小值的堆. 定义 对于左偏树中的一个节点x,离它最近的一个叶子结点经过的边数称为它的距离,记为 $dist(x)$ .特别地,外结点的距离为0,空节点(null)的距离为 1. 阅读全文
posted @ 2018-10-29 16:17 Ubospica 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 可并堆板子题. 见 "[模板] 左偏树" 代码 include include include include include include include using namespace std; define rep(i,l,r) for(register int i=(l);i=(r); i 阅读全文
posted @ 2018-10-29 16:16 Ubospica 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 卡读的毒瘤题== 看懂之后用 模拟.~~或者线段树~~ include include include include include include include using namespace std; define rep(i,l,r) for(register int i=(l);i=(r 阅读全文
posted @ 2018-10-29 16:11 Ubospica 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 求 $x=k$ 时满足一元一次不等式 $ax+b include include include include include include using namespace std; define rep(i,l,r) for(register int i=(l);i=(r); i) defin 阅读全文
posted @ 2018-10-29 16:05 Ubospica 阅读(170) 评论(0) 推荐(0) 编辑