摘要:
视频链接:https://www.bilibili.com/video/BV1Ff4y1e7YW/ #include<bits/stdc++.h> using namespace std; const int N=34; int a[N]; //把B进制数的每一位抠出存入数组 int f[N][N] 阅读全文
posted @ 2023-04-10 10:23
董晓
阅读(669)
评论(0)
推荐(0)
摘要:
视频链接:https://www.bilibili.com/video/BV1fa4y1H7J6/ Luogu P2657 [SCOI2009] windy 数 #include <bits/stdc++.h> using namespace std; const int N = 12; int a 阅读全文
posted @ 2023-04-10 10:22
董晓
阅读(800)
评论(0)
推荐(2)
摘要:
视频链接:https://www.bilibili.com/video/BV1fy4y1q79f/ #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=12; int 阅读全文
posted @ 2023-04-10 10:21
董晓
阅读(1050)
评论(0)
推荐(1)
摘要:
视频链接:E35 树形DP 积蓄程度_哔哩哔哩_bilibili 3585 -- Accumulation Degree #include <iostream> #include <cstring> #include <algorithm> using namespace std; const in 阅读全文
posted @ 2023-04-10 10:20
董晓
阅读(607)
评论(0)
推荐(1)
摘要:
E34 树形DP 树的中心_哔哩哔哩_bilibili U392706 【模板】树的中心 - 洛谷 在树中,如果节点 u 作为根节点时,从 u 出发的最长链最短,那么称 u 为树的中心。 树的中心不一定唯一,但最多有 2 个,且这两个中心是相邻的。 树的中心一定位于树的直径上。 树上所有点到其最远点 阅读全文
posted @ 2023-04-10 10:20
董晓
阅读(849)
评论(0)
推荐(0)
摘要:
E33 树形DP 树的直径_哔哩哔哩_bilibili U81904 【模板】树的直径 - 洛谷 树上任意两节点之间最长的简单路径即为树的直径。 一棵树可以有多条直径,他们的长度相等。 若树上所有边边权均为正,则树的所有直径中点重合。 // 树的直径 树形DP O(n) #include<bits/ 阅读全文
posted @ 2023-04-10 10:19
董晓
阅读(1106)
评论(3)
推荐(2)
摘要:
E32 树形DP 树的重心_哔哩哔哩_bilibili U104609 【模板】树的重心 - 洛谷 如果删除树中某个节点,使得各个子树的最大节点数最小,则该节点被称为树的重心。 树的重心如果不唯一,则至多有 2 个,且这两个重心相邻。 以树的重心为根时,所有子树的大小都不超过整棵树大小的一半。 树中 阅读全文
posted @ 2023-04-10 10:18
董晓
阅读(1319)
评论(0)
推荐(3)
摘要:
视频链接:https://www.bilibili.com/video/BV1cv411b7EG/ HDU1400 Mondriaan's Dream #include <iostream> #include <cstring> #include <algorithm> using namespac 阅读全文
posted @ 2023-04-10 10:17
董晓
阅读(850)
评论(0)
推荐(2)
摘要:
E30 区间DP 能量项链_哔哩哔哩_bilibili P1063 [NOIP 2006 提高组] 能量项链 - 洛谷 // 区间DP O(n^3) #include <bits/stdc++.h> using namespace std; const int N=210; int n, a[N]; 阅读全文
posted @ 2023-04-10 10:16
董晓
阅读(607)
评论(0)
推荐(1)
摘要:
E29 区间DP 环形石子合并_哔哩哔哩_bilibili P1880 [NOI1995] 石子合并 - 洛谷 // 区间DP O(n^3) #include <bits/stdc++.h> using namespace std; const int N=210; int n,a[N],s[N]; 阅读全文
posted @ 2023-04-10 10:15
董晓
阅读(708)
评论(0)
推荐(0)
摘要:
E28【模板】区间DP 石子合并——信息学竞赛算法_哔哩哔哩_bilibili P1775 石子合并(弱化版) - 洛谷 [1,1] [1,2] [1,3] [1,4] [1,5] [2,2] [2,3] [2,4] [2,5] [3,3] [3,4] [3,5] [4,4] [4,5] [5,5] 阅读全文
posted @ 2023-04-10 10:14
董晓
阅读(1029)
评论(0)
推荐(2)
摘要:
视频链接:https://www.bilibili.com/video/BV1vy4y1z7qy/ Luogu P2704 [NOI2001] 炮兵阵地 #include <iostream> #include <cstring> #include <algorithm> using namespa 阅读全文
posted @ 2023-04-10 10:13
董晓
阅读(908)
评论(0)
推荐(4)
摘要:
视频链接:https://www.bilibili.com/video/BV1BA411j7Qv/ Luogu P1879 [USACO06NOV]Corn Fields(玉米田) POJ3254 Corn Fields #include <iostream> #include <cstring> 阅读全文
posted @ 2023-04-10 10:12
董晓
阅读(990)
评论(2)
推荐(1)
摘要:
视频链接:https://www.bilibili.com/video/BV1pf4y1q7hU/ Luogu P1896 [SCOI2005] 互不侵犯 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共8个 阅读全文
posted @ 2023-04-10 10:11
董晓
阅读(1299)
评论(0)
推荐(5)
摘要:
视频链接:https://www.bilibili.com/video/BV15v411r7WD/ #include <iostream> #include <cstring> using namespace std; const int N = 100010; int w[N],f[N][2]; 阅读全文
posted @ 2023-04-10 10:10
董晓
阅读(477)
评论(0)
推荐(2)
摘要:
视频链接:https://www.bilibili.com/video/BV1ka4y1s7ER/ #include<iostream> #include<cstring> using namespace std; const int N=100010, M=110; int w[N], f[N][ 阅读全文
posted @ 2023-04-10 10:09
董晓
阅读(580)
评论(1)
推荐(1)
摘要:
视频链接:https://www.bilibili.com/video/BV1iK4y177jT/ #include<iostream> #include<cstring> using namespace std; const int N = 100010; int w[N],f[N][2]; in 阅读全文
posted @ 2023-04-10 10:08
董晓
阅读(645)
评论(0)
推荐(1)
摘要:
视频链接:https://www.bilibili.com/video/BV1TK4y1E7ft/ // 分步转移 #include<iostream> using namespace std; const int N=100010; int w[N],f[N]; int main(){ int n 阅读全文
posted @ 2023-04-10 10:06
董晓
阅读(699)
评论(1)
推荐(1)
摘要:
视频链接:https://www.bilibili.com/video/BV1454y1C7AR/ #include<iostream> #include<cstring> using namespace std; const int N = 1010; int v[N],w[N]; int f[N 阅读全文
posted @ 2023-04-10 10:05
董晓
阅读(643)
评论(0)
推荐(0)
摘要:
E19 背包DP 求方案数_哔哩哔哩_bilibili U224067 背包问题求方案数 - 洛谷 U636783 背包九题-背包问题求方案数 - 洛谷 // 不超背包容量的方案数 O(n*m) #include<bits/stdc++.h> using namespace std; const i 阅读全文
posted @ 2023-04-10 10:04
董晓
阅读(776)
评论(0)
推荐(2)
摘要:
视频链接:E18【模板】树上背包 P2014 [CTSC1997] 选课_哔哩哔哩_bilibili 题意:有 n 个物品和一个容量是 V 的背包。物品之间具有依赖关系,构成一棵树。如果选择一个物品,则必须选择它的父节点。 思路:在树上做背包DP 以每个结点为根的子树看做一个物品组,可能选择:只选根 阅读全文
posted @ 2023-04-10 10:03
董晓
阅读(1505)
评论(1)
推荐(2)
摘要:
E17【模板】树形DP P1352 没有上司的舞会_哔哩哔哩_bilibili P1352 没有上司的舞会 - 洛谷 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int 阅读全文
posted @ 2023-04-10 10:02
董晓
阅读(1152)
评论(0)
推荐(0)
摘要:
E16 背包DP 分组背包_哔哩哔哩_bilibili // 分组背包 朴素算法 #include<iostream> #include<cstring> using namespace std; const int N=110; int v[N][N],w[N][N],s[N]; // v[i,j 阅读全文
posted @ 2023-04-10 10:01
董晓
阅读(1001)
评论(1)
推荐(2)
摘要:
E15 背包DP 二维费用背包_哔哩哔哩_bilibili //二维费用 01背包 #include<iostream> using namespace std; int n,V,W; int f[110][110]; // f[j,k]:前i个物品,体积≤j,重量≤k 的最大价值 int main 阅读全文
posted @ 2023-04-10 09:59
董晓
阅读(673)
评论(0)
推荐(0)
摘要:
E14 背包DP 混合背包_哔哩哔哩_bilibili #include <iostream> using namespace std; const int N=1010,M=10000; int a[M],b[M],c[M]; int f[N]; int main(){ int n, m, v, 阅读全文
posted @ 2023-04-10 09:58
董晓
阅读(884)
评论(0)
推荐(3)
摘要:
E13 背包DP 多重背包 单调队列优化——信息学奥赛算法_哔哩哔哩_bilibili E11【模板】单调队列 滑动窗口最值 - 董晓 - 博客园 P1776 宝物筛选 - 洛谷 // 单调队列 O(n*W) #include<bits/stdc++.h> using namespace std; 阅读全文
posted @ 2023-04-10 09:57
董晓
阅读(1244)
评论(0)
推荐(3)
摘要:
E12 单调队列 最大连续和_哔哩哔哩_bilibili U162981 最大连续和 - 洛谷 f[i]表示选第 i 个数,且长度不超过m的最大连续和f[i] = max(s[i]-s[j]) = s[i]-min(s[j]), i-m<=j<=i-1,s为前缀和 // 单调队列 O(n) #inc 阅读全文
posted @ 2023-04-10 09:56
董晓
阅读(1031)
评论(2)
推荐(2)
摘要:
E11【模板】单调队列 滑动窗口最值_哔哩哔哩_bilibili P1886 滑动窗口 /【模板】单调队列 - 洛谷 // 单调队列 O(n) #include<iostream> using namespace std; const int N=1000010; int n,k,a[N],q[N] 阅读全文
posted @ 2023-04-10 09:24
董晓
阅读(1810)
评论(0)
推荐(5)
摘要:
E10 背包DP 多重背包 二进制优化——信息学奥赛算法_哔哩哔哩_bilibili #include <iostream> #include <algorithm> using namespace std; const int N=210; int n, m; int v[N], w[N], s[ 阅读全文
posted @ 2023-04-10 09:23
董晓
阅读(1263)
评论(1)
推荐(1)
摘要:
E09【模板】背包DP 完全背包_哔哩哔哩_bilibili U227266 完全背包问题 - 洛谷 // 朴素算法 TLE #include <iostream> #include <algorithm> using namespace std; const int N=1010; int n, 阅读全文
posted @ 2023-04-10 09:22
董晓
阅读(1182)
评论(0)
推荐(3)
摘要:
E08【模板】背包DP 01背包_哔哩哔哩_bilibili U225269 01背包问题 - 洛谷 P2871 [USACO07DEC] Charm Bracelet S - 洛谷 // 朴素算法 MLE #2 #10 #include <iostream> #include <cstring> 阅读全文
posted @ 2023-04-10 09:20
董晓
阅读(1610)
评论(0)
推荐(1)
摘要:
E07 线性DP 编辑距离_哔哩哔哩_bilibili P2758 编辑距离 - 洛谷 // 线性DP O(n^2) #include<bits/stdc++.h> using namespace std; const int N=2010; char a[N],b[N]; int n,m,f[N] 阅读全文
posted @ 2023-04-10 09:19
董晓
阅读(998)
评论(0)
推荐(1)
摘要:
E06 线性DP 最长公共子串_哔哩哔哩_bilibili T493246 最长公共子串 - 洛谷 // 线性DP O(n^2) #include<bits/stdc++.h> using namespace std; const int N=1005; char a[N],b[N]; int n, 阅读全文
posted @ 2023-04-10 09:17
董晓
阅读(888)
评论(0)
推荐(1)
浙公网安备 33010602011771号