上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 20 下一页
摘要: OSU! 期望dp SCUACM2022集训前训练-动态规划 - Virtual Judge (vjudge.net) 若连续 x 次成功的贡献是 x,则第 \(i\) 次对答案的贡献为 \(1*p\) 但连续 x 次成功的贡献是 \(x^3\), 而期望只有线性性质,对于 \(x^3\) 不可累加 阅读全文
posted @ 2022-05-28 20:42 hzy0227 阅读(35) 评论(0) 推荐(1) 编辑
摘要: Tele Broadcast 树上背包 SCUACM2022集训前训练-动态规划 - Virtual Judge (vjudge.net) 注意处理叶子结点 #include <iostream> #include <cstring> #include <algorithm> #include <v 阅读全文
posted @ 2022-05-28 20:35 hzy0227 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Centroids 换根dp SCUACM2022集训前训练-动态规划 - Virtual Judge (vjudge.net) 重心只有 1 个 或 2 个 待补 #include <iostream> #include <cstring> #include <algorithm> #includ 阅读全文
posted @ 2022-05-28 20:33 hzy0227 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 游走 高斯消元 + 期望dp HNOI2013]游走 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 设从第 \(i\) 个点出来的期望次数为 \(f[i]\) \(f[u]=\sum \frac {f[v]}{deg[v]}\;\;1<u<n\) \(f[1]=\sum \fra 阅读全文
posted @ 2022-05-28 20:31 hzy0227 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 高斯消元 #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <iomanip> using namespace std; typedef long long ll; const 阅读全文
posted @ 2022-05-26 19:12 hzy0227 阅读(14) 评论(0) 推荐(0) 编辑
摘要: st表 #include <iostream> #include <cstring> #include <cmath> using namespace std; const int N = 2e5 + 10, M = 18; int f[N][M], a[N]; int n, m; void ini 阅读全文
posted @ 2022-05-26 15:18 hzy0227 阅读(24) 评论(0) 推荐(0) 编辑
摘要: Arbitrage 判正环 套利问题,给出若干对货币兑换的汇率,求能否通过汇率兑换使钱越来越多 floyd求最长路,如果某一点到自身的最长路大于 1, 则可以 tarjan 判正环 #include <iostream> #include <cstring> #include <algorithm> 阅读全文
posted @ 2022-05-26 11:17 hzy0227 阅读(30) 评论(0) 推荐(0) 编辑
摘要: D - Journey dp 状态设计 \(f[p][t][x]\) 为从 p 店出发,向 x 方向走,当前是第 t 天,还能走多少个城市(包括 p) 其中 x 为 0 表示向左,1 表示向右 t 为 0 表示边的方向是初始方向,t 为 1 表示边的方向是初始方向相反 #include <iostr 阅读全文
posted @ 2022-05-25 22:05 hzy0227 阅读(17) 评论(0) 推荐(0) 编辑
摘要: C - Longest Simple Cycle dp 设 \(f[i]\) 为以第 \(i\) 个线段为环的右边界,环的最大长度 不妨令 \(l = min(a[i],b[i]),r =max(a[i],b[i])\) \(l\neq r\) 第 \(i-1\) 条线段的 \([l,r]\) 这部 阅读全文
posted @ 2022-05-25 22:01 hzy0227 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 仓鼠找 sugar LCA SCUACM2022集训前训练-图论 - Virtual Judge (vjudge.net) 首先要观察出一个结论:若 a - b 的路径与 c - d 的路径相交,设 a, b 的 LCA 为 x; c, d 的 LCA 为 y 则有 x 在 c - d 路径上 或 阅读全文
posted @ 2022-05-25 21:52 hzy0227 阅读(6) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 20 下一页