1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 #define maxn 500005 7 #define maxm 250005 8 ...
分类:
其他好文 时间:
2016-06-01 15:41:05
阅读次数:
236
计算所都不相同子串的个数,做法是所有子串的个数减去sigma(height[]).其中height数组的和便是所有相同子串的个数。 注意 N×(N+1)/2会爆int!但是最终答案在int内。所以使用sigma(n-sa[i]+1-height[i])的做法不会wa ...
分类:
编程语言 时间:
2016-05-19 23:18:14
阅读次数:
232
题目信息1093. Count PAT’s (25)时间限制120 ms
内存限制65536 kB
代码长度限制16000 B
The string APPAPT contains two PAT’s as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the secon...
分类:
其他好文 时间:
2016-05-18 19:31:34
阅读次数:
116
题意:
形如UVU这种字符串,其中U、V都是字符串,V的长度为L,那么称此种字符串为L-Gap String,要求的是一个字符串中有多少个子串为L-Gap String。
题解:
网上有很多关于此题的题解,但是都只是说了怎么做的,并没有说为什么是这样。
开始其实也不懂,后面写出来就好像懂了。
大概说一下思路,首先用后缀数组求出lcp是很容易想到的,
我们可以每次枚举U的长度L,那么就可...
分类:
其他好文 时间:
2016-05-12 23:47:51
阅读次数:
307
题目链接 题意:给定一个字符串,求不相同的子串的个数 分析:我们能知道后缀之间相同的前缀的长度,如果所有的后缀按照 suffix(sa[0]), suffix(sa[1]), suffix(sa[2]), …… ,suffix(sa[n])的顺序计算,不难发现,对于每一次新加进来的后缀 suffix ...
分类:
编程语言 时间:
2016-05-01 09:50:22
阅读次数:
196
hdu1238 暴力搜 Substrings Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9122 Accepted Submission(s ...
分类:
其他好文 时间:
2016-04-24 18:35:32
阅读次数:
158
String Problem Description There is a string S.S only contain lower case English character.(10≤length(S)≤1,000,000)How many substrings there are that ...
分类:
其他好文 时间:
2016-04-22 23:54:03
阅读次数:
204
长度不小于k的公共子串的个数,论文里有题解,卡了一上午,因为sum没开long long!!! 没开long long毁一生again~~~ 以后应该早看POJ里的Discuss啊QAQ 没开long long,毁我青春,耗我钱财,颓我精神== ...
分类:
其他好文 时间:
2016-04-22 11:55:09
阅读次数:
193
Given a string s, cut s into some substrings such that every substring is a palindrome. Return the minimum cuts needed for a palindrome partitioning o ...
分类:
其他好文 时间:
2016-04-03 20:10:22
阅读次数:
103