随笔分类 - 洛谷试炼场
摘要:题目大意: https://www.luogu.org/problemnew/show/P3384 树链剖分的讲解 两个dfs() 修改 查询 很详细很好理解 https://www.cnblogs.com/George1994/p/7821357.html 不过上面的讲解没有完整的代码 没有说到
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1736 题解 dplr[][] 当前点左边(副对角线时为右边)有多少个连续的0 dpup[][] 当前点上边有多少个连续的0 dp[][] 当前点左上有多少个连续的符合要求的1 主对角线时 dp[ i ][
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1417 题解 看第一份方法的公式 排序后01背包 #include <bits/stdc++.h> #define ll long long using namespace std; struct NODE
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1387 题解 第一份方法 原数组 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 dp[i][j]: 0 0 0 1 1 1 1 1 0 1 2 2 1 1 2 3 #include <bit
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1006 题解 不难想到 求从起点到终点的两条不同的路 因为只能向右或向下走 所以纸条1和2不可能同时位于同一行 dp[ i ][ j ][ k ]为 第 i 步时1位于 j 行2位于 k 行(这里为1~n行1
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1282 题解 当知道 总和 及 单行的和就可以算出差值的大小1 2 3 4(单行和l=10)8 7 6 5(总和s=36)则上下行的差值为 |l-(s-l)| #include <bits/stdc++.h>
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1280 题解 手推一遍思路更清晰 #include <bits/stdc++.h> using namespace std; struct NODE{ int x,y; }a[10005]; bool cmp
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1305 由题目可知,输入首位为 子树的根 其后为其左右儿子 则除各行首位后的位置中 没有出现的那个字母肯定为这整棵树的根 从其出发就可找出先序排列 #include <bits/stdc++.h> using
阅读全文
摘要:题目大意: 给一棵树的中序排列 后序排列,求这棵树的先序排列 https://www.luogu.org/problemnew/show/P1030 二叉树的四种遍历解说 几种遍历的递归实现 后序排列中 子树的最高层是一段排列中的最后一个 中序排列中 树(子树)的排列被其最高层分为左子树和右子树 即
阅读全文
摘要:题目大意: https://www.luogu.org/problemnew/show/P1020 Dliworth有两个互相对偶的定理:U的链划分使用的最少集合数,等于它的最大反链长度。(1)U的反链划分使用的最少集合数,等于它的最大链长度。(2) 更详细的讲解 #include <bits/st
阅读全文

浙公网安备 33010602011771号