随笔分类 -  不会自动AC的AC自动机/Trie树

摘要:Trie树(字典树) 树中任一结点p都对应于一个字符串S,S由从根出发走到p所经过的边上的字符构成 数据结构 操作 插入串 (复杂度为模式串长度) Trie图(AC自动机) 可以由Trie树为基础构造 终止节点:每个模式串最后一个结点 危险结点:终止节点和前缀指向危险结点的结点。 包含前缀指针(ne 阅读全文
posted @ 2018-12-30 16:29 TobicYAL 阅读(639) 评论(0) 推荐(0)
摘要:描述 In an edge-weighted tree, the xor-length of a path pis defined as the xor sum of the weights of edges on p: ⊕ is the xor operator. We say a path th 阅读全文
posted @ 2018-12-17 17:36 TobicYAL 阅读(398) 评论(0) 推荐(0)
摘要:描述 Biologists finally invent techniques of repairing DNA that contains segments causing kinds of inherited diseases. For the sake of simplicity, a DNA 阅读全文
posted @ 2018-10-29 23:26 TobicYAL 阅读(449) 评论(0) 推荐(0)
摘要:描述 有若干种病毒,每种病毒的特征代码都是一个01串。 每个程序也都是一个01串。 问是否存在不被病毒感染(不包含任何病毒的特征代码)的无限长的程序。 输入第一行是整数n,表示有n个病毒接下来n行,每行是一个由 0,1构成的字符串,表示一个病毒特征代码所有的病毒的特征代码总长度不超过30000输出如 阅读全文
posted @ 2018-10-29 23:24 TobicYAL 阅读(1194) 评论(0) 推荐(0)
摘要:描述 Aliens on planet Pandora also write computer programs like us. Their programs only consist of capital letters (‘A’ to ‘Z’) which they learned from 阅读全文
posted @ 2018-10-29 23:18 TobicYAL 阅读(762) 评论(0) 推荐(0)
摘要:描述 给若干个模式串,以及若干个句子,判断每个句子里是否包含模式串。 句子和模式串都由小写字母组成 输入第一行是整数n,表示有n个模式串 ( n <= 1000)接下来n行每行一个模式串。每个模式串长度不超过20接下来一行是整数m,表示有m个句子 (m <= 1000)接下来m行,每行一个句子,每个 阅读全文
posted @ 2018-10-29 23:15 TobicYAL 阅读(710) 评论(0) 推荐(0)