Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
55189 | _JF_ | 线性基 (basis) | C++ | 解答错误 | 20 | 24 MS | 256 KB | 399 | 2022-08-10 08:06:30 |
#include <bits/stdc++.h> using namespace std; #define LL long long const int N =1e6+10; int t[N]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { LL x; cin>>x; for(int j=0;j<20;j++) t[j]+=(x>>j)&1; } LL ans=0; for(int i=1;i<=n;i++) { LL now=0; for(int j=0;j<20;j++) if(t[j]!=0) t[j]--,now+=(1<<j); ans+=pow(now,2); } cout<<ans<<endl; }