上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页
摘要: 通道题意:给出n个数字,要你把这n个数字分成m堆,每一堆的价值是(max(val)-min(val))^2要你求出分成m堆之后得到的最小价值思路:排序,dp[i][j]表示前j个数字,分成i堆的最小价值,dp[i][j]=min(dp[i-1][k]+(val[j]-val[k+1])^2) 。代码... 阅读全文
posted @ 2015-08-01 22:52 mithrilhan 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 通道思路:x排序,去除无用点,会发现x升序,y降序,然后dp[i]=min(dp[k] + x[i] * y[k+1])代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 typedef long long l... 阅读全文
posted @ 2015-07-31 16:54 mithrilhan 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 题意:有n 个玩具需要装箱,每个玩具的长度为c[i],规定在装箱的时候,必须严格按照给出的顺序进行,并且同一个箱子中任意两个玩具之间必须且只能间隔一个单位长度,换句话说,如果要在一个箱子中装编号为i~j 的玩具,则箱子的长度必须且只能是l=j-i+sigma[c[k]],规定每一个长度为 l 的箱子... 阅读全文
posted @ 2015-07-31 16:41 mithrilhan 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 通道题意:有一段铁路有n个站,每个站可以往其他站运送粮草,现在要炸掉m条路使得粮草补给最小,粮草补给的公式是将每个站能收到的粮草的总和思路:dp[i][j]表示到j为止的前面炸了i条路的得到最小总数,cost[i][j+1]>cost[i][j],单调递减,满足。代码:#include #inclu... 阅读全文
posted @ 2015-07-31 16:37 mithrilhan 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 通道题意:n个A串,n个B串,求如何匹配使得LCP和最大。思路:裸的字典树,当时想复杂了。。。代码: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct Trie { 9 ... 阅读全文
posted @ 2015-07-31 15:38 mithrilhan 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 通道题意:给定一个长度为n的序列,和一个常数m,我们可以将序列分成随意段,每段的权值为sum(arr[i]) + C(l 2 #include 3 4 typedef long long ll; 5 6 const int MAX_N = 500007; 7 8 struct Point ... 阅读全文
posted @ 2015-07-29 13:34 mithrilhan 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 通道题意:n*m的矩阵,每个格子可以是0~9,给出各行的和和各列的和,求格子数字唯一方案,或判断无解或不唯一代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std;... 阅读全文
posted @ 2015-07-28 21:48 mithrilhan 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 通道题意:n*m的矩阵,每个格子可以是0~k,给出各行的和和各列的和,求格子数字唯一方案,或判断无解或不唯一思路:最大流,每行一个点,每列一个点,起点到每行的点连流量等于这行的和的边,每列的点连流量等于这列的和的边到终点,每行的点连到每列的点流量为K的点。所有行的和不等于所有列的和 或 最大流不等于... 阅读全文
posted @ 2015-07-28 21:46 mithrilhan 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 通道题意:代码: 阅读全文
posted @ 2015-07-28 20:02 mithrilhan 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 通道题意:n个数,A后缀和B的前缀相同,建边,问长度为m的有多少个。思路:建图,完了代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 typedef long long ll; 8 9 const int MA... 阅读全文
posted @ 2015-07-28 19:37 mithrilhan 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 通道题意:n个数,2种操作,1是单点更新,2是询问区间内序号为奇偶交错的和。代码: 1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include 3 #include 4 #include 5 #incl... 阅读全文
posted @ 2015-07-28 18:00 mithrilhan 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 通道:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4898题意:就是现在给出N个数, 然后给出M个数询问这M书中有多少个可以是由这N个数中... 阅读全文
posted @ 2015-07-24 16:12 mithrilhan 阅读(359) 评论(0) 推荐(0) 编辑
摘要: 通道:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2672题意:两个只包含字符'a', 'b'的字符串A和B, 求A的子串中与B的Hamm... 阅读全文
posted @ 2015-07-24 16:11 mithrilhan 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 通道:https://www.codechef.com/problems/COUNTARI题意:给出一个数列num[1..n], 每个数都是不超过30000的正整数, 现在求有多少个三元组(i, j, k)满足 1 2 #include 3 #include 4 #include 5... 阅读全文
posted @ 2015-07-24 16:09 mithrilhan 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 通道:http://acm.zju.edu.cn/onlinejudge/showProBlem.do?proBlemCode=3856题意:最多使用三个素数做加法和乘法(无括号),问得到X有多少种方案思路:6种情况:1、A,O(1)判断2、A+B, FFT处理3、A*B,lgN*lgN判断4、A*... 阅读全文
posted @ 2015-07-24 16:09 mithrilhan 阅读(218) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页