码迷,mamicode.com
首页 >  
搜索关键字:poj1226 substrings    ( 386个结果
SPOJ 8222 Substrings(后缀自动机)
【题目链接】 http://www.spoj.com/problems/NSUBSTR/ 【题目大意】 给一个字符串S,令F(x)表示S的所有长度为x的子串中,出现次数的最大值。 求出所有的F。 【题解】 在SAM中,一个串出现的次数就是|Right(s)|,我们按长度从小到大分配内存单位, 从后往 ...
分类:其他好文   时间:2016-11-16 01:59:37    阅读次数:182
POJ 3415 Common Substrings(后缀数组+单调栈)
【题目链接】 http://poj.org/problem?id=3415 【题目大意】 求出两个字符串长度大于k的公共子串的数目。 【题解】 首先,很容易想到O(n2)的算法,将A串和B串加拼接符相连, 做一遍后缀数组,把分别属于A和B的所有后缀匹配,LCP-k+1就是对答案的贡献, 但是在这个基 ...
分类:编程语言   时间:2016-11-16 01:31:42    阅读次数:191
SPOJ 705 Distinct Substrings(后缀数组)
【题目链接】 http://www.spoj.com/problems/SUBST1/ 【题目大意】 给出一个串,求出不相同的子串的个数。 【题解】 对原串做一遍后缀数组,按照后缀的名次进行遍历, 每个后缀对答案的贡献为n-sa[i]+1-h[i], 因为排名相邻的后缀一定是公共前缀最长的, 那么就 ...
分类:编程语言   时间:2016-11-15 23:49:35    阅读次数:357
UVALive6659 - Dromicpalin Substrings
题意 给一个字符串,找出其子串可化为回文串的个数,子串可以任意改变其顺序。 思路 遍历每一个子串,若子串长度为奇数且只有一个字母的个数为奇数 或 字串长度为偶数且所有字母个数为偶数,则此子串为所求串。 总结 刚开始漏看了题,导致题意读错。 挺简单一道题,比赛时不记得怎样遍历每个子串。 对自己有点信心 ...
分类:其他好文   时间:2016-09-28 02:17:18    阅读次数:210
【poj1226-出现或反转后出现在每个串的最长公共子串】后缀数组
题意:求n个串的最长公共子串,子串出现在一个串中可以是它的反转串出现。总长<=10^4. 题解: 对于每个串,把反转串也连进去。二分长度,分组,判断每个组。 这一题我曾经用kmp暴力水过。。贴一下代码 ...
分类:编程语言   时间:2016-09-26 14:44:43    阅读次数:179
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 representati ...
分类:其他好文   时间:2016-09-20 12:11:35    阅读次数:121
2016多校联合训练4 F - Substring 后缀数组
Description ?? is practicing his program skill, and now he is given a string, he has to calculate the total number of its distinct substrings. But ?? ...
分类:编程语言   时间:2016-08-28 01:13:16    阅读次数:232
POJ 3415 Common Substrings (求长度不小于k的公共子串的个数)
Common Substrings Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 10002 Accepted: 3302 Description A substring of a string T is defined as: ...
分类:其他好文   时间:2016-08-18 23:29:03    阅读次数:229
SPOJ - DISUBSTR Distinct Substrings (不相同的子串的个数)
Distinct Substrings Time Limit: 159MS Memory Limit: 1572864KB 64bit IO Format: %lld & %llu Description Given a string, we need to find the total numbe ...
分类:其他好文   时间:2016-08-16 23:37:20    阅读次数:144
ACM--字符串--Two Substrings--水
题目地址:传送门 D - Two Substrings Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description You are given string s. Your task i...
分类:其他好文   时间:2016-08-16 14:46:55    阅读次数:144
386条   上一页 1 ... 20 21 22 23 24 ... 39 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!