题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4650 https://www.luogu.org/problemnew/show/P1117 和 bzoj2119 股市的预测 一样. 考虑算出每个点往前的 AA 的个数和往后的 BB 的个数,每个点作为 AA 和 BB 分界点的答案累加起来就行. 算一个点开始的 AA 的个数,就是枚举 A 的长度 L ,然后每 L 个分为一段,在段的开头求 LCP 和 LCS ,给合法的位置区间加1就行…
Description If a string is in the form UVU, where U is not empty, and V has exactly L characters, we say UVUis an L-Gap string. For example, abcbabc is a 1-Gap string. xyxyxyxyxy is both a 2-Gap stringand also a 6-Gap string, but not a 10-Gap string…
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4650 https://www.luogu.org/problemnew/show/P1117 枚举每一段 a 的长度,然后分块,后缀数组求出每一块首关键点附近的可行范围: 然后用线段树区间加,区间查询: 在开头范围查询结尾,就得到长度 <= 当前长度 d 的前半部分接上长度 = d 的后半部分的答案: 在结尾范围查询开头,就得到长度 = d 的前半部分接上长度 < d 的后半部分的答案,…
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…
Musical Theme Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 27539 Accepted: 9290 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the…
http://uoj.ac/problem/35 以前做后缀数组的题直接粘模板...现在重新写一下模板 注意用来基数排序的数组一定要开到N. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N = 100003; int t1[N], t2[N], c[N]; void st(int *x, int *y, int *sa, int n, int…