异或平方和

· · 个人记录

题目描述如标题 给一个长度为N的数列,求\sum((a_i \text{ xor } a_j)^2)。

N<=5e4,a_i<=1e9

思路

没想到按位考虑,构建字典树,然后字典树合并。

代码(目前还在学校内网)