//lg p3812
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
ll d[100];
int n;
void Insert(ll x)
{
for(int i=62;i>=1;i--)
{
if(!(x>>(i-1))) continue;
if(!d[i])
{
d[i]=x;
return ;
}
else
{
x^=d[i];
}
}
}
ll FindMax()
{
ll ans=d[62];
for(int i=62;i>=1;i--)
{
if((ans^d[i])>ans)
{
ans^=d[i];
}
}
return ans;
}
int main()
{
// freopen("working.in","r",stdin);
// freopen("working.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++)
{
ll x;
cin>>x;
Insert(x);
}
cout<<FindMax();
return 0;
}
标签:working,int,ll,long,板子,62,ans,线性
From: https://www.cnblogs.com/yeyou26/p/17990714