2025.10.19 炼石计划 week8 容斥原理&计数类问题 讲课笔记

记录:1,2,3,4,8 \(\quad\) 9,6 \(\quad\) 11,12 \(\quad\) 13,15 \(\quad\) 22 \(\quad\) 10 \(\quad\) 7

题单:

https://www.mxoj.net/training/T1733?returnUrl=%2Ftraining%2FlistForGroup%3FgroupId%3D1124&groupId=1124

列表:
- [x] https://www.luogu.com.cn/problem/AT_arc104_d
- [x] https://www.luogu.com.cn/problem/AT_arc107_d
- [x] https://www.luogu.com.cn/problem/AT_arc179_d
- [x] https://www.luogu.com.cn/problem/AT_arc186_d
- [ ] https://qoj.ac/problem/7649
- [x] https://www.luogu.com.cn/problem/AT_arc117_e
- [x] https://www.luogu.com.cn/problem/AT_arc118_e
- [x] https://www.luogu.com.cn/problem/AT_arc193_c
- [x] https://www.luogu.com.cn/problem/CF1608F
- [x] https://www.luogu.com.cn/problem/P11802
- [x] https://www.luogu.com.cn/problem/AT_arc138_f
- [x] https://www.luogu.com.cn/problem/CF1988F
- [x] https://www.luogu.com.cn/problem/AT_agc027_e
- [ ] https://www.luogu.com.cn/problem/CF1605F
- [x] https://www.luogu.com.cn/problem/AT_arc188_d
- [ ] https://qoj.ac/problem/1262
- [ ] https://loj.ac/p/6703
- [ ] https://www.luogu.com.cn/problem/AT_xmascon20_f
- [ ] https://www.luogu.com.cn/problem/AT_agc036_f
- [ ] https://www.luogu.com.cn/problem/P5417
- [ ] https://www.luogu.com.cn/problem/CF2018F3
- [x] https://www.luogu.com.cn/problem/AT_ddcc2017_final_d
- [ ] https://www.luogu.com.cn/problem/CF1975I
- [ ] https://www.luogu.com.cn/problem/P7729

T5 QOJ#7649. 序列

考虑怎么样的序列是合法的

假设序列 \(a_{1\sim n}\) 中严格前缀最大值位置为 \(p_{1\sim k}\),其值域为 \([0,m]\),令 \(p_{k+1}=n+1\)\(a_{p_0}=0\)

\(a\) 合法当且仅当 \(\forall 1\le i\le k\)\(a[p_i+1,p_{i+1}-1]\) 为一个值域 \([a_{p_{i-1}}+1,a_{p_i}]\) 的合法序列

\(g_{n,m}\) 表示 \((n,m)\) 的答案,则

\[g_{0,m}=1\\ g_{n,m}=\sum_{a=1}^{n-1}\sum_{b=1}^m g_{n-a,m-b}g_{a-1,b}+\sum_{b=0}^m g_{n-1,b} \]

其中前一部分枚举 \(n-p_k+1=a,m-a_{p_{k-1}}=b\),后一部分处理 \(k=1\) 时的情况

暴力实现复杂度为 \(O(n^2m^2+q)\)

可证每个 \(g_{n,\ast}\) 都是不超过 \(n\) 次的多项式,因此可以拉格朗日插值做到 \(O(n^4+qn)\)

代码

可用生成函数等做到 \(O(n^2\text{polylog}(n)+qn)\)

参考

T7 AT_arc118_e [ARC118E] Avoid Permutations

T14 CF1605F PalindORme

T22 AT_ddcc2017_final_d なめらかな木 加强版

参考

T21 CF2018F3 Speedbreaker Counting (Hard Version)

posted @ 2025-10-21 19:13  Hstry  阅读(6)  评论(0)    收藏  举报