模板题。
代码:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
LL a[100];
int n;
void Insert(LL x)
{
for (int i=60;i>=0;i--)
if(x&(1LL<<i))
if(!a[i])
{
a[i]=x;
break;
}
else
x^=a[i];
}
LL Query_Max()
{
LL now=0;
for (int i=60;i>=0;i--)
if(!(now&(1LL<<i)))
now^=a[i];
return now;
}
void init()
{
scanf("%d",&n);
LL x;
for (int i=1;i<=n;i++)
scanf("%lld",&x),Insert(x);
}
void work()
{
printf("%lld
",Query_Max());
}
int main()
{
init();
work();
return 0;
}