...还能多说什么. 眼角一滴翔滑过. 一直以为题意是当前串与所有之前输入的串的LCP...然后就T了一整场. 扫了一眼标程突然发现他只比较输入的串和上一个串? 我心中突然有千万匹草泥马踏过. 然后随手就A了... 先RMQ预处理一下,复杂度为nlogn ,然后每次LCP询问只需O(1)的复杂度. #include <set> #include <map> #include <stack> #include <cmath> #include <queu…
http://acm.hdu.edu.cn/showproblem.php? pid=4691 去年夏天,更多的学校的种族称号.当时,没有后缀数组 今天将是,事实上,自己的后缀阵列组合rmq或到,但是,题意理解的一个问题,再折腾了很长时间,,,, 此处简单解释下题目例子吧,希望对读者有帮助  以最后一组数据为例 myxophytamyxopodnabnabbednabbingnabit 6 0 9 9 16 16 19 19 25 25 32 32 37 前两行不解释,题目叙述非常清楚 从第三行…
题意: 有一些1毛,2毛,5毛,1块的钢镚,还有一些价格不同的商品,现在要求你带一些钢镚,以保证这些商品中任选一件都能正好用这些钢镚付账,问最少带多少钢镚. 题解: 对于最优解,1毛的钢镚最多带1个,带两个就还不如带一个2毛的,同理2毛的最多带四个,5毛的最多带1个,一块的没有限制. 因此,预处理出1个1毛,4个2毛,1个5毛的所有子集,它们分别能组成哪些额度. 暴力枚举,并维护最少1块数量即可. #include<iostream> #include<set> #include&…
咕咕咕了太久  多校博客直接从第三场跳到了第九场orz 见谅见谅(会补的!) 明明最后看下来是dp场 但是硬生生被我们做成了组合数专场…… 听说jls把我们用组合数做的题都用dp来了遍 这里只放了用组合数的题目 dp的还没有补(这又是一个大坑orz) 1001 Rikka with Nash Equilibrium      (hdoj 6415) 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6415 题意:给一个n*m的矩阵 其中放着从1到n*m的…
2016暑假多校联合---Substring Problem 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 ?? thinks that is too easy, he wants to make this problem more interesti…
http://acm.hdu.edu.cn/showproblem.php?pid=5442 题意:给出一串字符串,它是循环的,现在要选定一个起点,使得该字符串字典序最大(顺时针和逆时针均可),如果有多个字典序相同的,则输出下标最小的,如果下标也是相同的,则输出顺时针方向的. 思路:用了三种方法: ①最简单的,暴力枚举所有情况,需要优化一下,先处理出字符串中字典序最大的单词,然后接下来的起点肯定是这个单词,否则就可以跳过这个起点. #include<iostream> #include<…
Rabbit's String Problem Description Long long ago, there lived a lot of rabbits in the forest. One day, the king of the rabbit kingdom got a mysterious string and he wanted to study this string. At first, he would divide this string into no more than…
Fleet of the Eternal Throne Problem Description > The Eternal Fleet was built many centuries ago before the time of Valkorion by an unknown race on the planet of Iokath. The fate of the Fleet's builders is unknown but their legacy would live on. Its…
题意: 有个打字机,在当前字符串后新加一个字花费p,把当前字符串的一个连续子串拷贝到当前字符串的末尾花费q,给定一个字符串,求用打字机打出这个字符串的最小花费. 题解: 容易想到用dp 记dp[i]为打出前i个字符的最小花费,对于每个i,令 A=dp[i-1]+p B=dp[j]+q 其中j为最小的,使得s[j+1~i]是s[1~j]的连续子串的值 其实就是,把这个字符串咔嚓切一刀,看后面的部分是不是前面部分的子串,如果不是,就把切的地方向后挪,前面的部分是原串,后面的部分是模式串. dp[i]…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6424 题意:定义f(A) = log log log log …. (A个log) n ,g[A,B,C] = f(A)^( f(B) ^ f(C) ),现在给定a, b两数组,数组大小最大为3,请计算当n趋向于无穷时,g[a1,a2…] / g[b1…]的值为无穷大或者是无穷小或者是某一个常数?对应输出 1, -1, 0. 题解:我们分别对G(A),G(B)取两次log,化简出来的公式就是  lo…