随笔分类 -  E 动态规划

摘要:视频链接:https://www.bilibili.com/video/BV16K411A7iC/ // 不超背包容量的方案数 #include<iostream> #include<cstring> using namespace std; const int N=1010, mod=1e9+7; 阅读全文
posted @ 2023-04-10 10:04 董晓 阅读(491) 评论(0) 推荐(1) 编辑
摘要:视频链接:E18【模板】树上背包 P2014 [CTSC1997] 选课_哔哩哔哩_bilibili 题意:有 n 个物品和一个容量是 V 的背包。物品之间具有依赖关系,构成一棵树。如果选择一个物品,则必须选择它的父节点。 思路:在树上做背包DP 以每个结点为根的子树看做一个物品组,可能选择:只选根 阅读全文
posted @ 2023-04-10 10:03 董晓 阅读(1032) 评论(0) 推荐(1) 编辑
摘要:视频链接:E17【模板】树形DP P1352 没有上司的舞会_哔哩哔哩_bilibili P1352 没有上司的舞会 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include <iostream> #include <cstring> #include <algorithm 阅读全文
posted @ 2023-04-10 10:02 董晓 阅读(753) 评论(0) 推荐(0) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV16a411w77X/ // 分组背包 朴素算法 #include<iostream> #include<cstring> using namespace std; const int N=110; int v[N][N], 阅读全文
posted @ 2023-04-10 10:01 董晓 阅读(641) 评论(1) 推荐(2) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1P54y1C7Ew/ //二维费用 01背包 #include <iostream> using namespace std; int f[110][110]; // f[j,k]:前i个物品,体积≤j,重量≤k 的最大价 阅读全文
posted @ 2023-04-10 09:59 董晓 阅读(425) 评论(0) 推荐(0) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1nV41127ZU/ #include <iostream> using namespace std; const int N=1010,M=10000; int a[M],b[M],c[M]; int f[N]; int 阅读全文
posted @ 2023-04-10 09:58 董晓 阅读(563) 评论(0) 推荐(1) 编辑
摘要:视频链接:E13 背包DP 多重背包 单调队列优化——信息学奥赛算法_哔哩哔哩_bilibili E11【模板】单调队列 滑动窗口最值 - 董晓 - 博客园 Luogu P1776 宝物筛选 // 单调队列 O(n*W) #include <iostream> #include <cstring> 阅读全文
posted @ 2023-04-10 09:57 董晓 阅读(805) 评论(0) 推荐(1) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1m54y117uu/ E11【模板】单调队列 滑动窗口最值 - 董晓 - 博客园 (cnblogs.com) LOJ10176 最大连续和 f[i]表示选第 i 个数,且长度不超过m的最大连续和f[i] = max(s[i 阅读全文
posted @ 2023-04-10 09:56 董晓 阅读(622) 评论(0) 推荐(0) 编辑
摘要:视频链接:E11【模板】单调队列 滑动窗口最值_哔哩哔哩_bilibili Luogu P1886 滑动窗口 /【模板】单调队列 #include <iostream> using namespace std; const int N=1000010; int a[N], q[N]; int mai 阅读全文
posted @ 2023-04-10 09:24 董晓 阅读(1137) 评论(0) 推荐(3) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1MA41177cg/ #include <iostream> #include <algorithm> using namespace std; const int N=210; int n, m; int v[N], w 阅读全文
posted @ 2023-04-10 09:23 董晓 阅读(775) 评论(1) 推荐(0) 编辑
摘要:视频链接:409【模板】背包DP 完全背包_哔哩哔哩_bilibili // 朴素算法 TLE #include <iostream> #include <algorithm> using namespace std; const int N=1010; int n, m; int v[N], w[ 阅读全文
posted @ 2023-04-10 09:22 董晓 阅读(718) 评论(0) 推荐(2) 编辑
摘要:视频链接:E08【模板】背包DP 01背包_哔哩哔哩_bilibili Luogu P2871 [USACO07DEC]Charm Bracelet S // 朴素算法 MLE #2 #10 #include <iostream> #include <cstring> #include <algor 阅读全文
posted @ 2023-04-10 09:20 董晓 阅读(1014) 评论(0) 推荐(1) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1gk4y1177j/ Luogu P2758 编辑距离 #include<iostream> #include<cstring> #include<algorithm> using namespace std; char 阅读全文
posted @ 2023-04-10 09:19 董晓 阅读(650) 评论(0) 推荐(0) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1hv41117gC/ #include<iostream> #include<cstring> using namespace std; char a[200]="BCCABCCB"; char b[200]="AACCA 阅读全文
posted @ 2023-04-10 09:17 董晓 阅读(580) 评论(0) 推荐(0) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1EK411K7Eb/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=1010; i 阅读全文
posted @ 2023-04-09 23:12 董晓 阅读(755) 评论(0) 推荐(0) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1Kp4y1e77H/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=100010; 阅读全文
posted @ 2023-04-09 22:25 董晓 阅读(769) 评论(1) 推荐(3) 编辑
摘要:视频链接:https://www.bilibili.com/video/BV1KK4y1e7t7/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=1010; i 阅读全文
posted @ 2023-04-09 22:24 董晓 阅读(665) 评论(0) 推荐(1) 编辑
摘要:视频链接:E02 线性DP 数字三角形_哔哩哔哩_bilibili Luogu P1216 [USACO1.5][IOI1994]数字三角形 Number Triangles #include <iostream> #include <cstring> #include <algorithm> us 阅读全文
posted @ 2023-04-09 18:45 董晓 阅读(571) 评论(0) 推荐(1) 编辑
摘要:视频链接:E01 记忆化搜索 数字三角形_哔哩哔哩_bilibili Luogu P1216 [USACO1.5][IOI1994]数字三角形 Number Triangles #include <iostream> #include <cstring> #include <algorithm> u 阅读全文
posted @ 2023-04-09 18:44 董晓 阅读(653) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示