题面
https://www.luogu.org/problem/P3812
题解
#include<cstdio> #include<cstring> #include<iostream> #define ri register int #define LL long long #define N 100 using namespace std; int n; LL a[N]; struct set { LL b[N]; void insert(LL c) { for (ri i=55;i>=0;i--) if (c&(1LL<<i)) { if (!b[i]) b[i]=c; c^=b[i]; } } LL query(LL x) { for (ri i=55;i>=0;i--) x=max(x,x^b[i]); return x; } } s; int main() { scanf("%d",&n); for (ri i=1;i<=n;i++) scanf("%lld",&a[i]); for (ri i=1;i<=n;i++) s.insert(a[i]); printf("%lld",s.query(0)); return 0; }