Problem's Link Mean: 有n个模式串和一篇文章,统计有多少模式串在文章中出现(正反统计两次). analyse: 好久没写AC自动机了,回顾一下AC自动机的知识. 本题在构造文章的时候需要仔细一点,其他没什么Trick,和普通AC自动机做法一样: build Trie  --->  build Fail_Ptr ---> matching_and_count Time complexity: O(N*L+M) Source code:  /* * this code is m…
题目连接:hdu 3695 Computer Virus on Planet Pandora 题目大意:给定一些病毒串,要求推断说给定串中包括几个病毒串,包括反转. 解题思路:将给定的字符串展开,然后匹配一次后反转后再匹配一次. #include <cstdio> #include <cstring> #include <queue> #include <vector> #include <iostream> #include <algor…
Computer Virus on Planet Pandora Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 256000/128000 K (Java/Others)Total Submission(s): 2578    Accepted Submission(s): 713 Problem Description     Aliens on planet Pandora also write computer progra…
Computer Virus on Planet Pandora Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 256000/128000 K (Java/Others) Total Submission(s): 4090    Accepted Submission(s): 1072 Problem Description     Aliens on planet Pandora also write computer prog…
Computer Virus on Planet Pandora Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 256000/128000 K (Java/Others)Total Submission(s): 2975    Accepted Submission(s): 833 Problem Description     Aliens on planet Pandora also write computer progra…
题意:有n种病毒序列(字符串),一个模式串,问这个字符串包括几种病毒. 包括相反的病毒也算.字符串中[qx]表示有q个x字符.具体见案列. 0 < q <= 5,000,000尽然不会超,无解 3 2 AB DCB DACB 3 ABC CDE GHI ABCCDEFIHG 4 ABB ACDEE BBB FEEE A[2B]CD[4E]F   Sample Output 0 3 2 Hint In the second case in the sample input, the revers…
病毒侵袭持续中 Problem's Link:http://acm.hdu.edu.cn/showproblem.php?pid=3065 Mean: 略 analyse: AC自动机的运用. 这一题需要将模式串都存储下来,还有就是base的取值一定要弄清楚,由于这题的模式串都是大写字母所以我们可以通过剪枝来加速. Time complexity:o(n)+o(ml)  Source code: ;; ; ;        ;        ; ; ||)   )  ;    ;;;}…
病毒侵袭 Problem's Link:http://acm.hdu.edu.cn/showproblem.php?pid=2896 Mean: 略 analyse: AC自动机的运用,多模式串匹配.就是有几个细节要注意,在这些细节上卡了半天了. 1)输出的网站编号和最终的病毒网站数不是一样的: 2)next指针要设128,不然会爆栈: 3)同理,char转换为int时,base要设为31: Time complexity:o(n)+o(ml)  Source code: ;; ; ;    …
F - Computer Virus on Planet Pandora Time Limit:2000MS     Memory Limit:128000KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3695 Appoint description:  System Crawler  (2014-11-05) Description     Aliens on planet Pandora also write…
  Computer Virus on Planet Pandora Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1353   Accepted: 256 Description Aliens on planet Pandora also write computer programs like us. Their programs only consist of capital letters (‘A’ to ‘Z’…