版本比较
题解:P13275 [NOI 2025] 集合
正文
增加 1 行删除 1 行
123345677 行未改动场切了,纪念一下。
记 $g(S,T)$ 表示集合对 $(S,T)$ 的权值,则答案为 $\sum_{f(S)=f(T)\land S\cap T=\empty} g(S,T)=\sum_{x}\sum_{S,T} [f(S)=f(T)=x\land S\cap T=\empty]g(S,T)$。 记 $g(S,T)$ 表示集合对 $(S,T)$ 的权值,则答案为 $\sum_{f(S)=f(T)\land S\cap T=\empty} g(S,T)=\sum_{x}\sum_{S,T} [f(S)=f(T)=x\land S\cap T=\empty]g(S,T)$。
设 $f_{x,y}=\sum_{x\subseteq S,y\subseteq T,S\cap T=\empty} g(S,T)$。容斥一下发现答案是 $\sum_{x,y}f_{x,y}(-1)^{\operatorname{popcnt}(x)+\operatorname{popcnt}(y)}2^{\operatorname{popcnt}(x\cap y)}$。
7 行未改动