码迷,mamicode.com
首页 >  
搜索关键字:substrings    ( 383个结果
POJ 3415 Common Substrings
单调栈的思想很巧妙,若进入的元素比栈顶小,则栈顶出栈,把相应信息更新一下,直到要进入的元素比栈顶元素大 //注意这道题和Facer’s string这道题的区别 //该题求的是sa[i]-sa[j]的lcp,需要用到的是height[i+1]-height[j] //而 Facer’s string这道题用到的是height[i]-height[j]的值,涉及到的是sa[i-1]-sa[j] ...
分类:其他好文   时间:2015-04-16 19:57:25    阅读次数:136
SPOJ DISUBSTR Distinct Substrings
后缀数组水题 先求所有的子串数,根据长度枚举,共(n+1)*n/2种 当height[i]>0时,说明height[i]这个前缀与其他子串相同,减去这height[i]个子串 #include #include #include using namespace std; #define N 1005 int r[N],sa[N],height[N],rank[N],wa[N],wb[N],w...
分类:其他好文   时间:2015-04-14 09:59:40    阅读次数:125
LeetCode Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great / gr ...
分类:其他好文   时间:2015-04-13 19:01:32    阅读次数:141
hdu3518---Boring counting(后缀数组,对后缀分组)
Problem Description 035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out how many substrings appear at least twice,moreover,s...
分类:编程语言   时间:2015-04-09 15:34:55    阅读次数:213
LeetCode --- 87. Scramble String
题目链接:Scramble String Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": ...
分类:其他好文   时间:2015-04-07 23:33:46    阅读次数:556
POJ1226---Substrings(后缀数组+二分)
Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given str...
分类:编程语言   时间:2015-04-07 21:52:51    阅读次数:169
Codeforces Round #166 (Div. 2)---D. Good Substrings(字符串)
You’ve got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l…r] (1?≤?l?≤?r?≤?|s|) of string s??=??s1s2…s|s| (where |s| is the length...
分类:其他好文   时间:2015-04-01 22:07:34    阅读次数:221
POJ 3415 Common Substrings(长度不小于k 的公共子串的个数--后缀数组+单调栈优化)
题意:给定两个字符串A 和B,求长度不小于k 的公共子串的个数(可以相同)。 样例1: A=“xx”,B=“xx”,k=1,长度不小于k 的公共子串的个数是5。 样例2: A =“aababaa”,B =“abaabaa”,k=2,长度不小于k 的公共子串的个数是22。 思路: 如果i后缀与j后缀的LCP长度为L, 在L不小于K的情况下, 它对答案的贡献为L - K + 1. 于是...
分类:编程语言   时间:2015-04-01 09:40:02    阅读次数:208
SPOJ694--- DISUBSTR - Distinct Substrings(后缀数组)
Given a string, we need to find the total number of its distinct substrings. InputT- number of test cases. T<=20; Each test case consists of one string, whose length is <= 1000 OutputFor each test c...
分类:编程语言   时间:2015-03-31 22:31:39    阅读次数:163
【spoj705】 Distinct Substrings
【题目描述】给定一个字符串,计算其不同的子串个数。【输入格式】一行一个仅包含大写字母的字符串,长度=n或者所有后缀的排名都不同。 然后正常情况下k增加logN次,每次如果用计数排序只要O(N),一共O(NlogN)。 但是不会写计数排序啊QAQ。。所以用快排好了。。多加一个log,一般不会被卡的.....
分类:其他好文   时间:2015-03-30 22:58:49    阅读次数:277
383条   上一页 1 ... 29 30 31 32 33 ... 39 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!