q模拟入门 ARC139F Solution

ARC139F

等价于 \(F_{2}^m\) 里选出 \(n\) 个向量,求每种选择方案之和

枚举线性基大小 \(k\)​,设其主元是 \(a_1\sim a_k\)​,等价于让 \(n\)​ 个向量张成 \(k\)​ 维空间,

等价于数有多少个 \(n\)\(k\) 列的满秩 \(01\) 矩阵,转置矩阵后变成有多少个 \(k\)\(n\)\(01\) 矩阵线性无关

也等价于 \(n\)​ 维空间选出 \(k\)​ 个向量彼此线性无关,方案数:

\[\prod_{i=0}^{k-1}({2^n-2^i}) \]

线性基最大异或和期望:主元必选,非主元可选可不选

\[\sum 2^{a_i}+\sum_{i=0}^{a_k-1}[\forall j,a_j\neq i]\frac{1}{2}2^i=\frac{1}{2}(2^{a_k+1}-1+\sum 2^{a_i}) \]

再有主元之后有多少个线性基,那么考虑填入,从低到高依次填入,那么有填法:

\[\prod2^{a_i-(i-1)} \]

那么答案就是:

\[\begin{aligned} &\sum_{k=0}^{\min(n,m)}\sum_{a_1\sim a_k}\prod_{i=0}^{k-1}({2^n-2^i})\frac{1}{2}\left(\sum 2^{a_i}+2^{a_k+1}-1 \right)\prod_{i=1}^{k}2^{a_i-(i-1)}\\ =&\sum_{k=0}^{\min(n,m)}\sum_{a_1\sim a_k}\prod_{i=0}^{k-1}({2^{n-i}-1})\frac{1}{2}\left(\sum 2^{a_i}+2^{a_k+1}-1 \right)\prod_{i=1}^{k}2^{a_i}\\ =&\sum_{k=0}^{\min(n,m)}\prod_{i=0}^{k-1}({2^{n-i}-1})\sum_{a_1\sim a_k}\left(\sum 2^{a_i}+2^{a_k+1}-1 \right)2^{-1+\sum a_i}\\ \end{aligned} \]

问题就在于求出后面部分

对于 \(\sum_{a_1\sim a_k}2^{\sum a_i}=[x^k]\prod_{i=0}^{m-1}(1+2^{i}x)=2^{k(k-1)/2}·{m\choose k}_2\)

\(F(x)=\prod_{i=0}^{m-1}(1+2^ix)\),则有:

\[F(2x)=\prod_{i=1}^{m}(1+2^ix)=\frac{F(x)·(1+2^mx)}{1+x} \]

也就是 \((1+x)F(2x)=F(x)(1+2^mx)\implies 2^kf_k+2^{k+1}f_{k+1}=2^mf_{k}+f_{k+1}\)

我们得到 \(f_{k+1}=\frac{2^m-2^k}{2^{k+1}-1}f_k\),又因为 \(f_0=1\),所以有

\[f_n=\prod_{k=0}^{n-1}\frac{2^m-2^k}{2^{k+1}-1}=\prod_{k=0}^{n-1}\frac{2^k(2^{m-k}-1)}{2^{k+1}-1}=2^{n(n-1)/2}\prod_{k=0}^{n-1}\frac{2^{m-k}-1}{2^{n-k}-1}=2^{n(n-1)/2}{m\choose n}_2 \]

所以 \(-1\) 可以拿出来了。

再考虑 \(\sum_{a_1\sim a_k}2^{\sum a_i}·\sum 2^{a_i}\) 怎么弄,不妨设其为 \(F(m,k)\)

可以将其表达为 \(\sum 2^m-1-\sum_{\forall j,a_j\neq i} 2^i\)

而后面这一部分,事实上可以考虑按位统计贡献,也就是考虑选出 \(k+1\) 个元素时候,保留原本的 \(a_1\sim a_k\),加入一个新的 \(j\),式子也就变成了 \(\sum 2^{j+\sum a_i}\)

也就是:

\[\begin{aligned} F(m,k)&=(2^m-1)2^{k(k-1)/2}{m\choose k}_2-\sum_{j=0}^{m-1}\sum_{a_1\sim a_k,j\neq a_i,\forall i}2^{j+\sum a_i}\\ &=(2^m-1)2^{k(k-1)/2}{m\choose k}_2-\sum _{a_1\sim a_{k+1}}{k+1\choose k}2^{\sum_{i=1}^{k+1} a_i}\\ &=(2^m-1)2^{k(k-1)/2}{m\choose k}_2-(k+1)2^{k(k+1)/2}{m\choose k+1}_2 \end{aligned} \]

然后考虑 \(2^{a_k+1}2^{\sum a}\)

可以考虑枚举 \(a_k\),有:

\[\begin{aligned} &=\sum_{t=1}^m 2^t\sum_{a_1\sim a_k,a_k=t-1}2^{\sum a_i}\\ &=\sum_{t=1}^m2^{2t-1}\sum_{a_1\sim a_{k-1},a_{k-1}<t-1}2^{\sum a_i}\\ &=\sum_{t=1}^m2^{2t-1}2^{(k-1)(k-2)/2}{t-1\choose k-1}_2\\ &=2^{(k-1)(k-2)/2+1}\sum_{t=0}^{m-1}2^{2t}{t\choose k-1}_2\\ &=2^{(k-1)(k-2)/2+1}\sum_{t=0}^{m-1}(2^{t+1}·2^{t-k+1}·2^{k-2}){t\choose k-1}_2\\ &=2^{k(k-1)/2}\sum_{t=0}^{m-1}(2^{t+1}-1)2^{t-k+1}{t\choose k-1}_2+2^{t-k+1}{t\choose k-1}_2\\ &=2^{k(k-1)/2}\left({m\choose k}_2+\sum_{t=0}^{m-1}(2^{t+1}-1)2^{t-k+1}{t\choose k-1}_2\right)\\ \end{aligned} \]

又因为:

\[{t\choose k}_q=\prod_{i=0}^{k-1}\frac{q^{t-i}-1}{q^{k-i}-1}\implies {t+1\choose k+1}_q={t\choose k}_q\frac{q^{t+1}-1}{q^{k+1}-1} \]

所以有:

\[\begin{aligned} &=2^{k(k-1)/2}\left({m\choose k}_2+\sum_{t=0}^{m-1}(2^{t+1}-1)2^{t-k+1}{t\choose k-1}_2\right)\\ &=2^{k(k-1)/2}\left({m\choose k}_2+(2^k-1)\sum_{t=0}^{m-1}2^{t-k+1}{t+1\choose k}_2\right)\\ &=2^{k(k-1)/2}\left({m\choose k}_2+(2^{k}-1)\sum_{t=1}^{m}2^{t-k}{t\choose k}_2\right)\\ &=2^{k(k-1)/2}\left({m\choose k}_2+(2^k-1){m+1\choose k+1}_2\right) \end{aligned} \]

全部回代,答案是:

\[\begin{aligned} &=\sum_{k=0}^{\min(n,m)}\prod_{i=0}^{k-1}({2^{n-i}-1})\sum_{a_1\sim a_k}\left(\sum 2^{a_i}+2^{a_k+1}-1 \right)2^{-1+\sum a_i}\\ &=\sum_{k=0}^{\min(n,m)}\frac{1}{2}\prod_{i=0}^{k-1}({2^{n-i}-1})\times \\ &\left((2^m-1)2^{k(k-1)/2}{m\choose k}_2-(k+1)2^{k(k+1)/2}{m\choose k+1}_2-2^{k(k-1)/2}·{m\choose k}_2+ 2^{k(k-1)/2}\left({m\choose k}_2+(2^k-1){m+1\choose k+1}_2\right)\right)\\ &=\frac{1}{2}\sum_{k=0}^{\min(n,m)}\prod_{i=0}^{k-1}(2^{n-i}-1)2^{k(k-1)/2}\left({m\choose k}_2(2^{m+1}-2^{m-k}-1)-{m\choose k+1}_2(k2^k+1)\right) \end{aligned} \]

posted @ 2024-11-18 16:34  spdarkle  阅读(2)  评论(0编辑  收藏  举报