随笔分类 - 多项式 FFT/NTT
摘要:洛谷传送门 AtCoder 传送门 首先做一些初步的观察:A 和 B 的解法是对称的,所以 A 对的方案数等于 B 对的方案数。同时若 A 和 B 同时对则每个置换环环长为 ,方案数为 。 所以,若设 A 对的方案数为 ,那么答案为 \(n!^2 - (x - n!)
阅读全文
摘要:洛谷传送门 所求即为: \[\begin{aligned} f_t & = \sum\limits_{m = 0}^L \binom{L}{m} A^m [k \mid m - t] \\ & = \frac{1}{k} \sum\limits_{m = 0}^L \binom{L}{m} A^m
阅读全文
摘要:洛谷传送门 AtCoder 传送门 和 CF1010F Tree 基本一致。 考虑经典树形背包,设 为 子树内选了 个点的方案数。初始有 。每次考虑合并儿子 ,有转移: \[f_{u, i + j} \get
阅读全文
摘要:洛谷传送门 AtCoder 传送门 设数字 第一次拿到的时间为 ,所求即为 。 施 min-max 容斥,有: \[\begin{aligned}E(\max\limits_{i = 1}^m t_i) & =
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF960G "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/960/G "CF 传送门") 发现设排列最大值位置为 ,那么 $[1, i]
阅读全文
摘要:洛谷传送门 感觉跟 CF Gym 102978H Harsh Comments 很像。 考虑容斥,钦定 中的人比 后死。设 为 中的人比 后死的概率,那么答案为: \[ans = \sum\limit
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/P6667 "洛谷传送门") 点值不好搞。考虑把它搞成系数一类的东西。 由二项式反演,$f(x) = \sum\limits_{i = 0}^x \binom{x}{i} b_i \Leftrightarrow b_i
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc309_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc309/tasks/abc309_h "AtCoder 传送门") 挺妙的题。 考虑
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc153_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc153/tasks/arc153_e "AtCoder 传送门") 我们考虑给定 $X
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc307_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc307/tasks/abc307_h "AtCoder 传送门") 一开始看错题了,看
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc281_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc281/tasks/abc281_h "AtCoder 传送门") 考虑设
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc247_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc247/tasks/abc247_h "AtCoder 传送门") 考虑我们如何判定一
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc213_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc213/tasks/abc213_h "AtCoder 传送门") 考虑一个朴素 dp
阅读全文
摘要:洛谷传送门 AtCoder 传送门 好题。 这种题一般可以考虑,观察最优解的性质,对于性质计数。 发现如果 均为偶数,可以放满。就是类似这样: #.#.#. .#.#.# #.#.#. .#.#.# 因此答案就是 。 如果 有一个为偶数,不妨假设
阅读全文