题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3507 题目大意:给你n个数,然后问你怎么分割当前的这n个数位那几组,使得每一组的权值加起来最大.每一组权值的计算方法在题目上说了. 具体思路: 一开始打了一波两重for循环的,一直求一个tile,但是wa了.然后就学了斜率优化的方法 https://www.cnblogs.com/ka200812/archive/2012/08/03/2621345.html 就是把表达式转换成斜率类型的表达式,然…
Zero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is too old to work for a long time and it will certainly wear and tear, so Zero use a cost to evaluate this degree. One day…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3507 Zero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is too old to work for a long time and it will certainly wear and tear,…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4123 题目大意: 给一棵树,n个节点,每条边有个权值,从每个点i出发有个不经过自己走过的点的最远距离Ma[i],有m个询问,每个询问有个q,求最大的连续节点区间长度ans,使得该区间内最大的M[i]和最小的M[j]之差不超过q. 解题思路一: 这套题目好卡时间. 树形dp+二分+单调队列,几个基本的知识点杂糅在一起. 先用树形dp求出从任意一点i出发的Ma[i].两遍dfs,第一遍求出每个节点为根…
                                     Largest Rectangle in a Histogram 这么经典的题硬是等今天碰到了原题现场懵逼两小时才会去补题...废话不多说: 题意:截取一个矩形使其面积最大,随你怎么截,反正面积要最大.输出最大面积,注意爆int. 思路:dp或单调队列.核心思路是从一个小矩形往两边扩散,分别找两边第一个小于这个矩形的位置,其中面积就是这个小矩形与区间长度的乘积,我们预处理出所有的小矩形的这两个端点值,然后扫一遍即可更新到最…
Print Article Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 11761    Accepted Submission(s): 3586 Problem Description Zero has an old printer that doesn't work well sometimes. As it is antiqu…
题目链接:hdu 3507 Print Article 题意: 每个字有一个值,现在让你分成k段打印,每段打印需要消耗的值用那个公式计算,现在让你求最小值 题解: 设dp[i]表示前i个字符需要消耗的最小值,那么有dp[i]=min{dp[k]+(sum[i]-sum[k])2+m)}(k<i). 这样是n2 的做法. 考虑用斜率优化: 设k<j,对于dp[i],从k+1到i为一段比j+1到i为一段更优. 那么有 dp[j]+(sum[i]-sum[j])2+m<=dp[k]+(sum[…
题目链接:https://vjudge.net/problem/HDU-3507 Print Article Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 14899    Accepted Submission(s): 4648 Problem Description Zero has an old printer that doe…
 Print Article Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 7960    Accepted Submission(s): 2465 Problem Description Zero has an old printer that doesn't work well sometimes. As it is antiq…
Batch Scheduling Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4347   Accepted: 1992 Description There is a sequence of N jobs to be processed on one machine. The jobs are numbered from 1 to N, so that the sequence is 1,2,..., N. The s…