摘要: 阅读全文
posted @ 2021-03-13 14:26 zxsoul 阅读(41) 评论(0) 推荐(0) 编辑
摘要: /* 序列DP 对于每一行 f[i][j]=max(f[k][j-1]+max(蓝 红,[k,i]) 对于每一行 dp[i][j],i表示行号, dp[i][j]=max(dp[i][j-k]+f[m][k]); 答案 dp[n][T]; */ #include <cmath> #include < 阅读全文
posted @ 2021-03-13 10:11 zxsoul 阅读(28) 评论(0) 推荐(0) 编辑
摘要: /* 区间DP,其中一种类型, 转移分阶段性,且阶段性分两组 i组,j组 */ #include <cmath> #include <queue> #include <cstdio> #include <vector> #include <cstring> #include <iostream> # 阅读全文
posted @ 2021-03-13 09:12 zxsoul 阅读(24) 评论(0) 推荐(0) 编辑
摘要: DP从入门到入土 目录DAGDP区间DP序列DP树形DP换根DP背包DP期望DP装压DP单调队列优化 DAGDP 食物链 简单的拓扑DP,转移方程通式 \(f[v]+=f[u],rd[v]--\) 犯错 for (int i=head[u];i;i=e[i].nxt) { int v=e[i].v; f[v]+=f[ 阅读全文
posted @ 2021-03-13 08:10 zxsoul 阅读(120) 评论(3) 推荐(1) 编辑
摘要: /* 食物链 拓扑图DP */ #include <cmath> #include <queue> #include <cstdio> #include <vector> #include <cstring> #include <iostream> #include <algorithm> #def 阅读全文
posted @ 2021-03-13 08:08 zxsoul 阅读(42) 评论(0) 推荐(0) 编辑