2013年4月20日

hdu 3695 Computer Virus on Planet Pandora AC自动机

摘要: Computer Virus on Planet PandoraTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 256000/128000 K (Java/Others)Total Submission(s): 1609Accepted Submission(s): 454Problem DescriptionAliens on planet Pandora also write computer programs like us. Their programs only consist of capital letters (‘A’ t 阅读全文

posted @ 2013-04-20 20:38 电子幼体 阅读(183) 评论(0) 推荐(0) 编辑

hdu 3695 AC自动机模板题

摘要: Keywords SearchTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23502Accepted Submission(s): 7763Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to 阅读全文

posted @ 2013-04-20 19:19 电子幼体 阅读(171) 评论(0) 推荐(0) 编辑

[置顶] AC自动机算法与AC自动机专辑

摘要: AC自动机算法AC自动机简介:首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有字典树Trie和KMP模式匹配算法的基础知识。KMP算法是单模式串的字符匹配算法,AC自动机是多模式串的字符匹配算法。AC自动机的构造:1.构造一棵Trie,作为AC自动机的搜索数据结构。2.构造fail指针,使当前字符失配时跳转到具有最长公共前后缀的字符继续匹配。如同 KMP算法一样, AC自动机在匹配时如 阅读全文

posted @ 2013-04-20 19:01 电子幼体 阅读(277) 评论(0) 推荐(0) 编辑

AC自动机算法与AC自动机专辑

摘要: AC自动机算法AC自动机简介:首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有字典树Trie和KMP模式匹配算法的基础知识。KMP算法是单模式串的字符匹配算法,AC自动机是多模式串的字符匹配算法。AC自动机的构造:1.构造一棵Trie,作为AC自动机的搜索数据结构。2.构造fail指针,使当前字符失配时跳转到具有最长公共前后缀的字符继续匹配。如同 KMP算法一样, AC自动机在匹配时如 阅读全文

posted @ 2013-04-20 19:01 电子幼体 阅读(199) 评论(0) 推荐(0) 编辑

AC自动机模板

摘要: 每个节点只访问一次。//子树节点是在插入时new的, //寻找失配指针中使用的队列是直接调用STL的 const int kind = 26; struct node { node *fail; node *next[kind]; int count;//记录当前前缀是完整单词出现的个数 node() { fail = NULL; count = 0; memset(next,NULL,sizeof(next)); } }; void insert(char *str,node *root) { ... 阅读全文

posted @ 2013-04-20 18:26 电子幼体 阅读(145) 评论(0) 推荐(0) 编辑

Magic Tree 水dp 错题!

摘要: Magic TreeTime Limit 1000msMemory Limit 65536Kdescription Every acmer dream for gold medal. Fotunately,there are two magic trees (which are conveniently numbered 1 and 2) in our campus, each full of gold medal. The trees are very high, so we can not touch the gold medal when they are in the tree bu. 阅读全文

posted @ 2013-04-20 18:01 电子幼体 阅读(205) 评论(0) 推荐(0) 编辑

Trip 图dp

摘要: TripTime Limit 1000msMemory Limit 65536Kdescription Xiao wang has a new car, so he wants to have a trip from his home to hefei, however, there is no road from his house directly to Hefei, so he has to go through a number of cities to get to hefei, his car takes one unit of time driving a unit dista. 阅读全文

posted @ 2013-04-20 17:54 电子幼体 阅读(110) 评论(0) 推荐(0) 编辑

Reverse a Road 最短路

摘要: Reverse a RoadTime Limit 1000msMemory Limit 65536Kdescription Peter resides in the city of Nanuh, and goes to his working place in this city every weekday.He has been totally annoyed with the road traffic of this city. All the roads in this city are one-way, so he has to drive a longer way than he . 阅读全文

posted @ 2013-04-20 17:44 电子幼体 阅读(178) 评论(0) 推荐(0) 编辑

导航