题面 题意:给你一个字符串,问你满足s[i]=s[2n-i]=s[2n+i-2]的子串(这子串长度为3n-2)有多少个,原字符串长度<=5e5 题解:对于这种子串,其实要满足2个回文,跑过一次Manacher后,len[i]表示以i向两边扩展最远的回文串长度, 那么对于答案,实际就是统计满足下列条件(i,j)的对数 i  <= j j - i <= len[i] j - i <= len[j] 移项就是 i >= j -  len[j] j <= i + len[i]…
转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 题意:给出一个带边权的图.对于每一个询问(S , T , K , A , B),有两种操作,加一条单位边花费为A,将某条边流量扩展一个单位花费为B,在预算为K的情况下求S到T最大流的最大值. http://acm.hdu.edu.cn/showproblem.php?pid=4729 做法:如果A <= B,很明显只做添加边操作,而且只加在S -…
Alice are given an array A[1..N] with N numbers. Now Alice want to build an array B by a parameter K as following rules: Initially, the array B is empty. Consider each interval in array A. If the length of this interval is less than K, then ignore th…
Palindrome Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 426    Accepted Submission(s): 163 Problem Description Alice like strings, especially long strings. For each string, she has a specia…
Problem Description Pfctgeorge is totally a tall rich and handsome guy. He plans to build a huge water transmission network that covers the whole southwest China. To save the fund, there will be exactly one path between two cities. Since the water ev…
题意 求区间l,r的子串在原串中第k次出现的位置. 链接:https://vjudge.net/contest/322094#problem/C 思路 比赛的时候用后缀自动机写的,TLE到比赛结束. 学了后缀数组后,发现这题用后缀数组写还简单些. 我们把样例aaabaabaaaab后缀排序后列出来: 比如我们的l,r,k为2,3,2,那么先找到2,3表示的子串为aa,后缀数组的height数组表示的是相邻两个后缀(排序后)的最长公共前缀长度,往这个方向去想,[l,r]这个子串肯定是某个后缀的前缀…
题意: 有\(n\)根长度不一的棍子,q次询问,求\([L,R]\)区间的棍子所能组成的周长最长的三角形.棍长\(\in [1, 1e9]\),n\(\in [1, 1e5]\). 思路: 由于不构成三角形的数组为菲波那切数列,所以当棍数超过44时,长度超过1e9,所以从最大开始数最多不超过45次就能找到构成三角形.所以直接主席树查询区间第k大.复杂度\(O(45 * q * logn)\). 代码: #include<map> #include<set> #include<…
Palindrome Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 433    Accepted Submission(s): 168 Problem Description Alice like strings, especially long strings. For each string, she has a specia…
2017 ccpc哈尔滨 A题 Palindrome 题意: 给一个串\(T\),计算存在多少子串S满足\(S[i]=S[2n−i]=S[2n+i−2](1≤i≤n)\) 思路: 很明显这里的回文串长度为奇数,所以用\(manacher\)处理时不需要添加间隔字符 所以这里的\(Len[i]\)表示的就是以\(i\)为中心的回文串向左右最远能延伸的长度 那么\(S[i]=S[2n−i]=S[2n+i−2](1≤i≤n)\)就等价于 找到一对$(i,j), 满足i - Len[i] + 1 <=…
Super Mario Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5101    Accepted Submission(s): 2339 Problem Description Mario is world-famous plumber. His “burly” figure and amazing jumping abilit…