版权声明:https://blog.csdn.net/huashuimu2003 https://blog.csdn.net/huashuimu2003/article/details/85412800
题目
https://www.luogu.org/problemnew/show/P3812
代码
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=51;
ll a[maxn], p[101];
inline ll read()
{
ll x=0,f=1;
char ch=getchar();
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
return x*f;
}
void getlist(ll x)
{
for (int i=62;i>=0;--i)
{
if (!(x>>(ll)i)) continue;
if (!p[i])
{
p[i]=x;
break;
}
x^=p[i];
}
}
int main()
{
ll n=read(),ans;
for (int i=1;i<=n;++i)
getlist(a[i]=read());
for (int i=62;i>=0;--i)
if ((ans^p[i])>ans)
ans^=p[i];
cout<<ans;
return 0;
}