dX 容斥题单

https://vjudge.net/contest/792382

有一些重复的就不放了吧。链接有pdf。

qoj15623 Charity Raffle

题意:
初始为 0,长度为 \(n\) 的序列 \(a\),进行 \(k\) 次以下操作:

  • 选择二元组 \(1\le x< y\le n\)。
  • 将 \(a_x,a_y\) 中较小者加一。相等时给 \(a_x\) 加一。

求最终能得到多少种 \(a\) 序列,满足 \(\max a \le m\)。

考虑一个序列合法条件:最大值和次大值差不超过 1,且次大值在最大值右侧。
那么造出最大值后其他值都是可以造出来的。
考虑枚举最大值是多少

qoj15326 Yet another 01 problem

P11458 [USACO24DEC] All Pairs Similarity P

P10064 [SNOI2024] 公交线路

GYM104053J Math Exam

\(S_i=(\frac{a_i+1}{2})^2\),设 \(b_i=\frac{|a_i+1|}{2}\),则 \(b_i^2=S_i\)。

\[\begin{aligned} b_i^2&=b_{i-1}^2\pm 2b_i-1\\ b_i^2\pm 2b_i+1&=b_{i-1}^2\\ (b_i\pm 1)^2&=b_{i-1}^2\\ \pm b_i\pm 1&=b_{i-1}\\ b_i&=b_{i-1} \pm 1 \end{aligned} \]

\(b_i\in [0,\frac{m+1}{2}]\)。反射容斥板子。

posted @ 2026-02-25 18:58  TallBanana  阅读(49)  评论(0)    收藏  举报