ACM_AC自动机
chudongfang2015
开心开心!!!!!!
展开
-
AC自动机专题——B - 病毒侵袭 HDU - 2896
当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋――我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~ 但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他决定要把世界上所有带病毒的网站都找出来。当然,谁都知道这是不可能的。小t却执意要完成这不能的任务,他说原创 2017-04-15 21:06:53 · 410 阅读 · 0 评论 -
AC自动机专题——P - 考研路茫茫――单词情结 HDU - 2243 矩阵快速幂+AC自动机
背单词,始终是复习英语的重要环节。在荒废了3年大学生涯后,Lele也终于要开始背单词了。 一天,Lele在某本单词书上看到了一个根据词根来背单词的方法。比如"ab",放在单词前一般表示"相反,变坏,离去"等。 于是Lele想,如果背了N个词根,那这些词根到底会不会在单词里出现呢。更确切的描述是:长度不超过L,只由小写字母组成的,至少包含一个词根的单词,一共可能有多少个呢?这里就不考虑单原创 2017-04-16 17:34:17 · 617 阅读 · 0 评论 -
AC自动机专题——L - Wireless Password HDU - 2825 状压DP+AC自动机
Liyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. Liyuan did not know the password of the network, but he got some important information fr原创 2017-04-16 17:11:19 · 988 阅读 · 0 评论 -
AC自动机专题——K - Ring HDU - 2296 DP+AC自动机
For the hope of a forever love, Steven is planning to send a ring to Jane with a romantic string engraved on. The string's length should not exceed N. The careful Steven knows Jane so deeply that he k原创 2017-04-16 17:04:27 · 602 阅读 · 0 评论 -
AC自动机专题——J - DNA repair HDU - 2457 DP+AC自动机
Biologists finally invent techniques of repairing DNA that contains segments causing kinds of inherited diseases. For the sake of simplicity, a DNA is represented as a string containing characters 'A'原创 2017-04-16 16:46:11 · 397 阅读 · 0 评论 -
AC自动机专题——H - Text Generator SPOJ - GEN 矩阵快速幂+AC自动机
LoadingTime has been given a task these days. He is required to write a tool called Text Generator. This software is widely used among the kids who are under seven. It generates an article with the si原创 2017-04-16 16:40:26 · 424 阅读 · 0 评论 -
AC自动机专题——G - DNA Sequence POJ - 2778 矩阵快速幂+AC自动机
It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment ATC then原创 2017-04-16 16:33:56 · 415 阅读 · 0 评论 -
AC自动机专题——F - Censored! POJ - 1625 大数+DP+AC自动机
The alphabet of Freeland consists of exactly N letters. Each sentence of Freeland language (also known as Freish) consists of exactly M letters without word breaks. So, there exist exactly N^M differe原创 2017-04-16 16:25:45 · 357 阅读 · 0 评论 -
AC自动机专题——E - Censored! URAL - 1158 大数+DP+AC自动机
The alphabet of Freeland consists of exactly N letters. Each sentence of Freeland language (also known as Freish) consists of exactly M letters without word breaks. So, there exist exactly N M differe原创 2017-04-16 13:20:44 · 436 阅读 · 0 评论 -
AC自动机专题——D - Word Puzzles SPOJ - WPUZZLES 矩阵字符
Word puzzles are usually simple and very entertaining for all ages. They are so entertaining that Pizza-Hut company started using table covers with word puzzles printed on them, possibly with the in原创 2017-04-16 13:09:18 · 759 阅读 · 0 评论 -
AC自动机专题——A - Keywords Search HDU - 2222
In the modern time, Search engine came into the life of everybody like Google, Baidu, etc. Wiskey also wants to bring this feature to his image retrieval system. Every image have a long descriptio原创 2017-04-15 20:59:13 · 535 阅读 · 0 评论 -
AC自动机专题——C - 病毒侵袭持续中 HDU - 3065
小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己知彼,百战不殆,小t首先要做的是知道这个病毒网站特征:包含多少不同的病毒,每种病毒出现了多少次。大家原创 2017-04-15 21:11:15 · 521 阅读 · 0 评论 -
AC自动机算法详解
首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有模式树(字典树)Trie和KMP模式匹配算法的基础知识。AC自动机算法分为3步:构造一棵Trie树,构造失败指针和模式匹配过程。转载 2017-04-16 17:36:58 · 411 阅读 · 0 评论