上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 45 下一页
摘要: E33 树形DP 树的直径_哔哩哔哩_bilibili U81904 【模板】树的直径 - 洛谷 树上任意两节点之间最长的简单路径即为树的直径。 一棵树可以有多条直径,他们的长度相等。 若树上所有边边权均为正,则树的所有直径中点重合。 // 树的直径 树形DP O(n) #include<bits/ 阅读全文
posted @ 2023-04-10 10:19 董晓 阅读(1040) 评论(3) 推荐(2)
摘要: E32 树形DP 树的重心_哔哩哔哩_bilibili U104609 【模板】树的重心 - 洛谷 如果删除树中某个节点,使得各个子树的最大节点数最小,则该节点被称为树的重心。 树的重心如果不唯一,则至多有 2 个,且这两个重心相邻。 以树的重心为根时,所有子树的大小都不超过整棵树大小的一半。 树中 阅读全文
posted @ 2023-04-10 10:18 董晓 阅读(1238) 评论(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 董晓 阅读(833) 评论(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 董晓 阅读(590) 评论(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 董晓 阅读(691) 评论(0) 推荐(0)
摘要: E28【模板】区间DP 石子合并——信息学竞赛算法_哔哩哔哩_bilibili P1775 石子合并(弱化版) - 洛谷 [1,1] [2,2] [3,3] [4,4] [5,5] [1,2] [2,3] [3,4] [4,5] [1,3] [2,4] [3,5] [1,4] [2,5] [1,5] 阅读全文
posted @ 2023-04-10 10:14 董晓 阅读(975) 评论(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 董晓 阅读(873) 评论(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 董晓 阅读(968) 评论(2) 推荐(1)
摘要: 视频链接:https://www.bilibili.com/video/BV1pf4y1q7hU/ Luogu P1896 [SCOI2005] 互不侵犯 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共8个 阅读全文
posted @ 2023-04-10 10:11 董晓 阅读(1257) 评论(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 董晓 阅读(463) 评论(0) 推荐(2)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 45 下一页