题目链接 Problem Description Uncle Mao is a wonderful ACMER. One day he met an easy problem, but Uncle Mao was so lazy that he left the problem to you. I hope you can give him a solution.Given a string s, we define a substring that happens exactly k time…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6704 题意为查询子串s[l...r]第k次出现的位置. 写完博客后5分钟的更新 写完博客才发现这份代码和杭电的代码查重了.... 为什么会变成这样呢?是我先交的,明明是我先交的… 激动!!第一次网络赛做出这种(板子)题. 首先求一下后缀数组的Height,我们知道Height数组表示两个排名相邻的后缀的最长公共前缀,则Height数组的区间最小值即为区间排名相邻的后缀的最长公共前缀. 我们想知道那些…
题目链接 Problem Description Now there are n gems, each of which has its own value. Alice and Bob play a game with these n gems.They place the gems in a row and decide to take turns to take gems from left to right. Alice goes first and takes 1 or 2 gems…
2018 ICPC 沈阳网络赛 Call of Accepted 题目描述:求一个算式的最大值与最小值. solution 按普通算式计算方法做,只不过要同时记住最大值和最小值而已. Convex Hull 题目描述:定义函数\(gay(x)\),若\(x\)是某个非\(1\)的数的平方的倍数,则\(gay(x)=0\),否则\(gay(x)=x^2\),求\(\sum_{num=1}^{n} ( \sum_{i=1}^{num} gay(x) ) mod p\) solution \[\sum…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6194 题意:告诉你一个字符串和k , 求这个字符串中有多少不同的子串恰好出现了k 次. 解法:后缀数组.我们先考虑至少出现k 次的子串, 所以我们枚举排好序的后缀i (sa[i]) .然后k段k 段的枚举.假设当前枚举的是 sa[i]~sa[i + k -1],那么假设这一段的最长公共前缀  是L 的话.那么就有L 个不同的子串至少出现了k次.我们要减去至少出现k + 1次的 , 但还要和这个k 段…
题目链接:https://nanti.jisuanke.com/t/41389 The value of a string sss is equal to the number of different letters which appear in this string. Your task is to calculate the total value of all the palindrome substring. Input The input consists of a single…
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5008 Description In this problem, you are given a string s and q queries. For each query, you should answer that when all distinct substrings of string s were sorted lexicographically, which one is…
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5853 Description Jong Hyok loves strings. One day he gives a problem to his friend you. He writes down n strings Pi in front of you, and asks m questions. For i-th question, there is a string Qi. We…
"Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between the two boundaries. You can pick up sev…
题意 求一个字符串中本质不同的回文子串的个数. $ 1\leq |string| \leq 100000$ 思路 好像是回文自动机的裸题,但是可以用 \(\text{Manacher}\) (马拉车)算法配合后缀数组(或配合哈希表)解决. \(\text{Manacher}\) 算法非常短小精悍,它可以在线性时空内求出以每个点为中心拓展的最远距离,筛出与 \(n\) 同阶个数个回文串,这些回文串包含原串所有本质不同的回文串. 为了判掉奇偶串的问题,我们为字符串穿插一个特殊字符,如字符串 abcc…