Min-Max 容斥学习笔记

感谢 lyc 哥哥上次给我讲了一下…然而我并没有听懂,只能自己再去学了一遍

Min-Max 容斥:

$$
\max(S) = \sum\limits_{S’ \subseteq S} \min(S’) (-1)^{|S’| - 1}
$$

可以用二项式反演证明:构造容斥函数 $f(x)$ 使得

$$
\max(S) = \sum\limits_{S’ \subseteq S} \min(S’) f(|S’|)
$$

考虑每个 $S’ \subseteq S$ 中 $\min(S’) = a_{x+1}$ 对答案的贡献为:

$$
g(x) = [x = 0] = \sum\limits_{i=0}^x {x \choose i} f(i+1)
$$

二项式反演得:

$$
\begin{aligned}
f(x + 1) &= \sum\limits_{i=0}^x (-1)^{x-i} {x \choose i} g(i) \\
\Rightarrow \ \ \ f(x + 1) &= (-1)^{x} \\
\Rightarrow \ \ \ f(x) &= (-1)^{x-1}
\end{aligned}
$$

所以:

$$
\begin{aligned}
\max(S) &= \sum\limits_{S’ \subseteq S} \min(S’) f(|S’|) \\
&= \sum\limits_{S’ \subseteq S} \min(S’) (-1)^{|S’| - 1}
\end{aligned}
$$

二项式反演学习笔记

二项式反演:

$$
\begin{aligned}
f_n=\sum_{i=0}^{n}(-1)^i {n \choose i} g_i
&\Leftrightarrow
g_n=\sum_{i=0}^{n}(-1)^i {n \choose i} f_i
\\
f_n=\sum_{i=0}^{n}{n \choose i} g_i
&\Leftrightarrow
g_n=\sum_{i=0}^{n}(-1)^{n-i} {n \choose i} f_i \end{aligned}
$$

BZOJ2839 - 集合计数

设 $a(i)$ 表示大于等于 $i$ 的方案数,则:

$$
a(i) = {n \choose i} (2^{2^{n-i}}-1)
$$

设 $f(i)$ 表示容斥系数,使得:

$$
ans = \sum\limits_{i=0}^n f(i) \times a(i)
$$

考虑单个集合并为 $x$ 的选取方案对 $ans$ 的贡献,设:

$$
g(x) = [ x = k ]
$$

则:

$$
g(x) = \sum\limits_{i=0}^x {x \choose i} f(i)
$$

二项式反演得:

$$
\begin{aligned}
f(x) &= \sum\limits_{i=0}^x {x \choose i} (-1)^{x-i} g(x) \\
&= {x \choose k} (-1)^{x-k} [x \ge k]
\end{aligned}
$$

代入得:

$$
\begin{aligned}
ans &= \sum\limits_{i=0}^n f(i) \times a(i) \\
&= \sum\limits_{i=0}^n {i \choose k} (-1)^{i-k} [i \ge k]
\times {n \choose i} (2^{2^{n-i}} - 1) \\
&= \sum\limits_{i=k}^n (-1)^{i-k} (2^{2^{n-i}} - 1) {i \choose k} {n \choose i}
\end{aligned}
$$

即可 $O(n \log n)$ 求解

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×