
字符串
文章平均质量分 81
cyendra
Azarath Metrion Zinthos
展开
-
ZOJ 3430 Detect the Virus AC自动机
Detect the VirusTime Limit: 2 Seconds Memory Limit: 65536 KBOne day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus th原创 2013-04-21 14:38:17 · 734 阅读 · 0 评论 -
MUTC 1 A - Clairewd’s message 扩展KMP
Clairewd’s messageTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2296 Accepted Submission(s): 901Problem DescriptionClairewd原创 2013-05-22 08:29:04 · 676 阅读 · 0 评论 -
扩展KMP模板
#include#include#includeusing namespace std;const int MM=100005;int next[MM],extand[MM];char S[MM],T[MM];void GetNext(const char *T){ int len=strlen(T),a=0; next[0]=len; while(a<转载 2013-05-22 08:30:08 · 696 阅读 · 0 评论 -
UVa 10391 - Compound Words 字符串hash
Problem E: Compound WordsYou are to find all the two-word compound words in a dictionary. A two-word compound word is a word in the dictionary that is the concatenation of exactly two other word原创 2013-06-06 18:14:04 · 830 阅读 · 0 评论 -
UVALive 4513 Stammering Aliens 字符串Hash求LCS
DescriptionDr. Ellie Arroway has established contact with an extraterrestrial civilization. However, all efforts to decode their messages have failed so far because, as luck would have it, the原创 2013-08-27 20:45:46 · 852 阅读 · 0 评论 -
SPOJ 7758 Growing Strings AC自动机DP
7758. Growing StringsProblem code: MGLAR10 EnglishVietnamese Gene and Gina have a particular kind of farm. Instead of growing a原创 2013-09-05 16:43:58 · 1112 阅读 · 0 评论 -
【专题】KMP
挖坑...----------------------------一 模板----------------------------const int maxn=1111111;char P[maxn];char T[maxn];int f[maxn];void getFail(char P[],int f[]){ int i=0,j=-1; int原创 2013-09-29 15:27:17 · 1351 阅读 · 4 评论 -
SPOJ 1811 Longest Common Substring SAM
-----------------A string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the set of lowercase letters.Substring, also called factor, is a consecutiv原创 2013-10-10 14:00:36 · 694 阅读 · 0 评论 -
HDU 4622 Reincarnation SAM
-------------ReincarnationTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 1439 Accepted Submission(s): 503Problem Descript原创 2013-10-10 13:20:54 · 797 阅读 · 0 评论 -
后缀自动机(SAM)学习指南
*在学习后缀自动机之前需要熟练掌握WA自动机、RE自动机与TLE自动机*什么是后缀自动机后缀自动机 Suffix Automaton (SAM) 是一个用 O(n) 的复杂度构造,能够接受一个字符串所有后缀的自动机。它最早在陈立杰的 2012 年 noi 冬令营讲稿中提到。在2013年的一场多校联合训练中,陈立杰出的 hdu 4622 可以用 SAM 轻松水过,由此 S原创 2014-07-20 18:54:10 · 5134 阅读 · 1 评论 -
后缀数组 学习指南
什么是后缀数组后缀树(Suffix tree)是一种数据结构,能快速解决很多关于字符串的问题。原创 2014-07-30 17:14:26 · 968 阅读 · 0 评论 -
NEFU 697 Similar Word KMP
Similar WordTime Limit 1000msMemory Limit 65536Kdescription It was a crummy day for Lur. He failed to pass to the CET-6 (College English Test原创 2013-05-05 20:05:49 · 943 阅读 · 0 评论 -
NEFU English Game 字符串 dp 字典树
English GameTime Limit 1000msMemory Limit 65536Kdescription This English game is a simple English words connection game. The rules are as f原创 2013-04-29 11:41:24 · 1055 阅读 · 0 评论 -
AC自动机算法与AC自动机专辑
AC自动机算法AC自动机简介: 首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有字典树Trie和KMP模式匹配算法的基础知识。KMP算法是单模式串的字符匹配算法,AC自动机是多转载 2013-04-20 19:01:34 · 880 阅读 · 0 评论 -
AC自动机模板
每个节点只访问一次。//子树节点是在插入时new的,//寻找失配指针中使用的队列是直接调用STL的const int kind = 26;struct node{ node *fail; node *next[kind]; int count;//记录当前前缀是完整单词出现的个数 node() { fail = NULL;转载 2013-04-20 18:26:07 · 614 阅读 · 0 评论 -
hdu 2757 DNA repair AC自动机dp--------完全不懂--------
DNA repairTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 872 Accepted Submission(s): 473Problem DescriptionBiologists finall原创 2013-04-21 18:23:01 · 630 阅读 · 0 评论 -
UVa 10192 - Vacation 字符串dp
Problem E: Vacation The ProblemYou are planning to take some rest and to go out on vacation, but you really don't know which cities you should visit. So, you ask your parents for hel原创 2013-04-23 21:38:25 · 943 阅读 · 0 评论 -
Trie 模板
//用类,或者结构体定义都行class trie{public: trie* next[26]; int num; int value; trie() { for(int i=0;i<26;i++) next[i]=0; value=0;//记录是不是一个单词 num=0;//记录单词出现的次数转载 2013-04-16 20:49:52 · 780 阅读 · 0 评论 -
标准C++中的string类的用法总结
要想使用标准C++中string类,必须要包含#include // 注意是,不是,带.h的是C语言中的头文件using std::string;using std::wstring;或using namespace std;下面你就可以使用string/wstring了,它们两分别对应着char和wchar_t。string和wstri转载 2013-02-01 11:12:12 · 497 阅读 · 0 评论 -
LA 3942 - Remember the Word 字典树 dp
Neal is very curious about combinatorial problems, and now here comes a problem about words. Knowing that Ray has a photographic memory and this may not trouble him, Neal gives it to Jiejie.Since Ji原创 2013-04-19 19:49:47 · 840 阅读 · 0 评论 -
KMP算法模板
#include #include #include using namespace std;int f[1111111];void getfail(char* P,int *f){ int m=strlen(P); f[0]=f[1]=0; for (int i=1;i<m;i++) { int j=f[i]; w原创 2013-04-19 21:42:07 · 547 阅读 · 0 评论 -
LA 3026 - Period KMP失配函数的应用
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2原创 2013-04-19 21:41:14 · 787 阅读 · 0 评论 -
hdu 3695 AC自动机模板题
Keywords SearchTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23502 Accepted Submission(s): 7763Problem DescriptionIn the mo原创 2013-04-20 19:19:25 · 720 阅读 · 0 评论 -
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): 1609 Accepted Submission(s): 454Problem Descrip原创 2013-04-20 20:38:44 · 824 阅读 · 0 评论 -
ACdream 1430 SETI 后缀自动机/后缀数组 不重叠子串的个数
--------/** this code is made by cyendra* Problem: 1430* Verdict: Accepted* Submission Date: 2014-10-06 13:10:01* Time: 5740MS* Memory: 3804KB*/#include #include #include using namespac原创 2014-10-06 18:16:18 · 1192 阅读 · 0 评论