从大到小枚举答案 kkk。 aia_iai 答案能取到 kkk,要求存在 xxx 满足 ai⊕xa_i\oplus xai⊕x 出现在 aaa 中,且 popcount(x)=k\operatorname{popcount}(x)=kpopcount(x)=k。也就是存在 aja_jaj 和 popcount(x)=k\operatorname{popcount}(x)=kpopcount(x)=k 的 xxx,满足 aj⊕x=aia_j \oplus x=a_iaj⊕x=ai。 把所有 popcount(x)=k\operatorname{popcount}(x)=kpopcount(x)=k 的 xxx 拿出来和 aaa FWT 即可。复杂度 O(m22m)O(m^2 2^m)O(m22m)。