随笔分类 -  动态规划

【codeforces 19/10/26 div2】E.Rock In Push
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 using namespace std; 5 6 #define mfor(i,a,b) for(register int i=(a);i<=(b);i++) 7 #def 阅读全文
posted @ 2019-10-28 13:28 thjkhdf12 阅读(134) 评论(0) 推荐(0)
【树形DP】P2014 选课
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib> 阅读全文
posted @ 2019-10-24 13:42 thjkhdf12 阅读(113) 评论(0) 推荐(0)
【树形DP】P1352 没有上司的舞会
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib> 阅读全文
posted @ 2019-10-23 19:48 thjkhdf12 阅读(93) 评论(0) 推荐(0)
【树形DP】P2015 二叉苹果树
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib> 阅读全文
posted @ 2019-10-23 18:45 thjkhdf12 阅读(105) 评论(0) 推荐(0)
【dij+dp】P1772 [ZJOI2006]物流运输
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib> 阅读全文
posted @ 2019-10-22 19:12 thjkhdf12 阅读(105) 评论(0) 推荐(0)
【未知】P2331 [SCOI2005]最大子矩阵
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int n, m, k; 6 int s1[101], s2[101], f[101][101][11]; 7 8 int main() 9 { 10 cin 阅读全文
posted @ 2019-10-09 13:23 thjkhdf12 阅读(114) 评论(0) 推荐(0)
【未知】P2216 [HAOI2007]理想的正方形
摘要:1 #include<iostream> 2 using namespace std; 3 4 const int INF = 0x3f3f3f3f; 5 6 int a, b, n; 7 int g[1010][1010]; 8 int maxn[1010][1010], minn[1010][1 阅读全文
posted @ 2019-10-09 13:22 thjkhdf12 阅读(103) 评论(0) 推荐(0)
【状压dp】P2157 [SDOI2009]学校食堂
摘要:1 #include <cmath> 2 #include <cstdio> 3 #include <cstring> 4 #include <iostream> 5 #include <algorithm> 6 using namespace std; 7 8 const int INF = 0x 阅读全文
posted @ 2019-10-09 13:20 thjkhdf12 阅读(89) 评论(0) 推荐(0)
【常规dp】P1415 拆分数列
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<cstdio> 5 using namespace std; 6 7 const int maxn = 510; 8 9 char s[maxn]; 1 阅读全文
posted @ 2019-10-09 13:19 thjkhdf12 阅读(102) 评论(0) 推荐(0)
【神奇的DP】P2051 [AHOI2009]中国象棋
摘要:1 #include<iostream> 2 using namespace std; 3 4 int n, m; 5 const int mod = 9999973; 6 7 inline long long mul(long long x, long long y) 8 { 9 long lon 阅读全文
posted @ 2019-10-09 13:18 thjkhdf12 阅读(110) 评论(0) 推荐(0)
【常规DP】P2577 [ZJOI2005]午餐
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 6 pair<int, int> p[210]; 7 int f[210][40010]; 8 int sum[210]; 阅读全文
posted @ 2019-10-09 13:16 thjkhdf12 阅读(290) 评论(0) 推荐(0)
【悬线法】P1169 [ZJOI2007]棋盘制作
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 using std::cin; 5 using std::cout; 6 using std::max; 7 using std::min; 8 using std::e 阅读全文
posted @ 2019-10-09 13:14 thjkhdf12 阅读(108) 评论(0) 推荐(0)
【树上分组背包】P1273 有线电视网
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 6 struct node 7 { 8 int to, w, nxt; 9 node() {}; 10 node(int a 阅读全文
posted @ 2019-10-09 13:12 thjkhdf12 阅读(112) 评论(0) 推荐(0)
【类背包】P1156 垃圾陷阱
摘要:1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 int dp[101][1001]; 6 7 struct rub 8 { 9 int t, g, h; 10 }c[101]; 11 12 bool cm 阅读全文
posted @ 2019-10-09 13:11 thjkhdf12 阅读(102) 评论(0) 推荐(0)
【区间dp】P1220 关路灯
摘要:1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 6 int pos[51]; 7 int w[51]; 8 int sum[51][51]; 9 int f[51][51] 阅读全文
posted @ 2019-10-09 13:10 thjkhdf12 阅读(106) 评论(0) 推荐(0)
【常规dp】P1373 小a和uim之大逃离
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 using namespace std; 5 6 int a[810][810]; 7 int f[810][810][20][2]; 8 const int mod = 阅读全文
posted @ 2019-10-09 13:08 thjkhdf12 阅读(122) 评论(0) 推荐(0)
【区间DP】P1005 矩阵取数游戏
摘要:1 #include <iostream> 2 #include <algorithm> 3 #include <vector> 4 #include <cstring> 5 using namespace std; 6 7 #define lll __int128 8 9 int n, m; 10 阅读全文
posted @ 2019-10-09 13:07 thjkhdf12 阅读(107) 评论(0) 推荐(0)