随笔分类 -  ACM-动态规划-基础DP

摘要:CodeForces - 597C Subsequences 一拿到这个题感觉很新颖,不过没啥思路。 看了大家的题解,一个$O(n^2\times k)$的做法还是能写一写,虽然过不了。 因为本题所有数字是个全排列,我们设状态是$dp[i][j]$,表示长度为$i$的子序列,以$j$结尾的方案数。 阅读全文
posted @ 2018-09-05 23:20 卷珠帘 阅读(165) 评论(0) 推荐(0)
摘要:CodeForces 628E Zbazi in Zeydabad 这个树状数组很巧妙。 将$O(n^3)$降到$O(n^2logn)$。 每个对角线的加和相等,建在一棵树上。 #include <bits/stdc++.h> using namespace std; const int maxn 阅读全文
posted @ 2018-09-03 23:29 卷珠帘 阅读(188) 评论(0) 推荐(0)
摘要:CodeForces 608C Chain Reaction #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 50; int cov[100010]; ///覆盖个数 int sum[maxn]; struct 阅读全文
posted @ 2018-04-11 09:17 卷珠帘 阅读(187) 评论(0) 推荐(0)
摘要:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1201 DP转移方程:dp[i][j] = dp[i-j][j]+dp[i-j][j-1]; dp[i][j] 表示将i分成j个不相等的数的个数。 dp[i-j][j]--> 阅读全文
posted @ 2017-06-19 21:59 卷珠帘 阅读(160) 评论(0) 推荐(0)
摘要:#include #include #include #include using namespace std; const int maxn = 1e3+5; int dp[maxn][maxn]; char s1[maxn]; char p[maxn]; int main() { int T;cin>>T; while(T--) { int n... 阅读全文
posted @ 2016-10-03 11:08 卷珠帘 阅读(183) 评论(0) 推荐(0)
摘要:C. Reberland Linguistics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output First-rate speci 阅读全文
posted @ 2016-09-05 23:47 卷珠帘 阅读(226) 评论(0) 推荐(0)
摘要:C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder and Chris 阅读全文
posted @ 2016-08-30 16:07 卷珠帘 阅读(212) 评论(0) 推荐(0)
摘要:2016 Multi-University Training Contest 1 这次比赛名次算是目前来最好的一次了,总共A了6题,几乎全是dp题。真是佩服一神。 HDU5763 Another Meaning (kmp+dp) 这道题开场后五分钟一神就给我们过来讲解法,我思考了好一会儿才理解。 k 阅读全文
posted @ 2016-07-28 23:26 卷珠帘 阅读(424) 评论(0) 推荐(0)
摘要:P1084 数字三角形4 题解:dp+dfs. #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; const int maxn = 40; int dp 阅读全文
posted @ 2016-07-28 17:19 卷珠帘 阅读(138) 评论(0) 推荐(0)
摘要:从最简单的开始: POJ:The Triangle #include <cstdio> #include <algorithm> #include <cstring> using namespace std; int dp[111][111]; int a[111][111]; int main() 阅读全文
posted @ 2016-07-27 22:08 卷珠帘 阅读(139) 评论(0) 推荐(0)
摘要:Partial Tree Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 823 Accepted Submission(s): 407 Pr 阅读全文
posted @ 2016-07-14 17:11 卷珠帘 阅读(156) 评论(0) 推荐(0)
摘要:In Action Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5220 Accepted Submission(s): 1745 Probl 阅读全文
posted @ 2016-07-11 23:47 卷珠帘 阅读(130) 评论(0) 推荐(0)
摘要:Employment Planning Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4782 Accepted Submission(s): 阅读全文
posted @ 2016-04-15 17:05 卷珠帘 阅读(147) 评论(0) 推荐(0)
摘要:Tickets Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2694 Accepted Submission(s): 1308 Problem 阅读全文
posted @ 2016-04-13 16:42 卷珠帘 阅读(207) 评论(0) 推荐(0)
摘要:Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 31490 Accepted S 阅读全文
posted @ 2016-04-13 15:56 卷珠帘 阅读(320) 评论(0) 推荐(0)
摘要:FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13643 Accepted Submission(s): 60 阅读全文
posted @ 2016-04-13 12:31 卷珠帘 阅读(689) 评论(0) 推荐(0)
摘要:FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7576 Accepted Submission(s): 阅读全文
posted @ 2016-04-13 00:17 卷珠帘 阅读(251) 评论(0) 推荐(0)
摘要:Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11391 Accepted Submission(s): 5 阅读全文
posted @ 2016-04-12 12:51 卷珠帘 阅读(141) 评论(0) 推荐(0)
摘要:Problem Description CA is a fine comrade who loves the party and people; inevitably she loves GCD (greatest common divisor) too. Now, there are N diff 阅读全文
posted @ 2016-04-03 00:59 卷珠帘 阅读(321) 评论(0) 推荐(1)