1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| #include <cstdio> #include <iostream> #include <algorithm> #define int long long using namespace std; const int MAXN = 65; const int BIT = 62;
int n, base[MAXN];
void insert (int x) { for (int i = BIT; i >= 0; i--) { if ((1ll << i) & x) { if (base[i] == 0) { base[i] = x; break; } else x ^= base[i]; } } }
int Maxval () { int res = 0; for (int i = BIT; i >= 0; i--) { res = max (res, res ^ base[i]); } return res; }
signed main () { scanf ("%lld", &n); for (int i = 1, x; i <= n; i++) { scanf ("%lld", &x); insert (x); } printf ("%lld\n", Maxval ()); return 0; }
|