随笔分类 - 背包
摘要:洛谷传送门 CF 传送门 放放/ll/ll/ll。 这题是个性质题。 首先第一排一定是升序,第二排一定是降序。考虑第一排若存在 使得 ,那么交换这两个数不会变劣。第二排类似。 然后发现在 走下去或在 走下去最优
阅读全文
摘要:洛谷传送门 AtCoder 传送门 和 CF1010F Tree 基本一致。 考虑经典树形背包,设 为 子树内选了 个点的方案数。初始有 。每次考虑合并儿子 ,有转移: \[f_{u, i + j} \get
阅读全文
摘要:洛谷传送门 AtCoder 传送门 人生中第一道 AtCoder 问号题。 设 。 注意到 的定义式中, 大概是启示我们转成概率去做。发现若把 换成 \(\frac{1}{n - 1}\
阅读全文
摘要:洛谷传送门 CF 传送门 典? 考虑枚举 ,算有多少种方案使得,存在一个点,离它最近的黑点距离 。 设 为 子树内离 最近的黑点距离为 。如果一个点子树中离它最近的黑点距离 ,那么它就已经满足子树的限制
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc041_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc041/tasks/agc041_f "AtCoder 传送门") 神题!!!!!!!
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1856E2 "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1856/E2 "CF 传送门") 考虑局部贪心,假设我们现在在 ,我们希
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1856E1 "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1856/E1 "CF 传送门") 考虑局部贪心,假设我们现在在 ,我们希
阅读全文
摘要:洛谷传送门 感觉跟 CF Gym 102978H Harsh Comments 很像。 考虑容斥,钦定 中的人比 后死。设 为 中的人比 后死的概率,那么答案为: \[ans = \sum\limit
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc162_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc162/tasks/arc162_d "AtCoder 传送门") 注意到,如果给定每
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc235_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc235/tasks/abc235_h "AtCoder 传送门") 为啥洛谷唯一一篇题
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc221_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc221/tasks/abc221_g "AtCoder 传送门") 这个数据范围让我们
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1839E "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1839/E "CF 传送门") 不会,不知道该如何评价。确实是自己的问题。 这种
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1830D "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1830/problem/D "CF 传送门") 考虑答案的下界。 对整棵树进行二分图染色,我们得到答案
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc207_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc207/tasks/abc207_f "AtCoder 传送门") 简单树形 dp。
阅读全文
摘要:洛谷传送门 AtCoder 传送门 首先将度数 。 设 为体积为 至多能用几个物品凑出来, 为至少。 我们现在要证明一个东西:, 合法。 首先若 合法,那么必须满足 $s - x \in [-
阅读全文