【HDOJ】2459 Maximum repetition substring】的更多相关文章

后缀数组+RMQ. /* 2459 */ #include <iostream> #include <sstream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <deque> #include <algorithm&g…
题目:Maximum repetition substring 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2459 题意:给你一个字符串,求连续重复出现次数最多的子串(不重叠),如果有多个,输出字典序最小的那个.别如aacdabcdab,a连续着重复出现2次,cdab连续着出现2次,但aa的字典序小,所以输出aa. 思路: 枚举+后缀树组+rmq 枚举重复串的长度,后缀数组预处理出height数组,rmq预处理height,实现O(1)查询. 给几…
sa在清空方面存在一些奇怪的问题……难以ac.(留坑?)…
后缀数组2倍增可解. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXM 28 #define MAXN 100010 ]; ]; ]; ]; char s[MAXN]; ], sa[MAXN*]; ], rank[MAXN*]; bool cmp(int *r, int a, int b, int l) { return r[a]==r[b] && r[a+l]==r…
[LeetCode]718. Maximum Length of Repeated Subarray 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/maximum-length-of-repeated-subarray/description/ 题目描述: Given two integer arr…
Maximum repetition substring Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9458   Accepted: 2915 Description The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same conse…
Maximum repetition substring Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7578   Accepted: 2281 Description The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same conse…
Maximum repetition substring Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6328   Accepted: 1912 Description The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same conse…
[SP1812]LCS2 - Longest Common Substring II 题面 洛谷 题解 你首先得会做这题. 然后就其实就很简单了, 你在每一个状态\(i\)打一个标记\(f[i]\)表示状态\(i\)能匹配到最长的子串长度, 显然\(f[i]\)可以上传给\(f[i.fa]\). 然后去每个串和第\(1\)个串\(f\)的最小值的最大值即可. 代码 #include <iostream> #include <cstdio> #include <cstdlib&…
[SP1811]LCS - Longest Common Substring 题面 洛谷 题解 建好后缀自动机后从初始状态沿着现在的边匹配, 如果失配则跳它的后缀链接,因为你跳后缀链接到达的\(Endpos\)集合中的串肯定是当前\(Endpos\)中的后缀,所以这么做是对的. 你感性理解一下,这样显然是最大的是吧... 具体实现看代码: 代码 #include <iostream> #include <cstdio> #include <cstdlib> #inclu…