RT,不知道哪里常数大了过不去
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a[32], ans;
ull yh[32];
int f(ull x)
{
int cnt = 0;
while(x>>=1)++cnt;
return cnt;
}
int main()
{
ios::sync_with_stdio(0);
int n; cin >> n;
for(int i = 0; i < n; ++i)
cin >> a[i];
for(ull S = 1; S < 1ull<<n; ++S)
{
ull lb = S&-S;
int cnt = f(lb);
if(!(S&(S-1)))
{
yh[cnt] = a[cnt];
ans ^= S*yh[cnt];
}
else
{
lb ^= S;
ull lb2 = lb&-lb;
int c2 = f(lb2);
yh[cnt] = yh[c2]^a[cnt];
ans ^= S*yh[cnt];
}
}
cout << ans << '\n';
return 0;
}