代码
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
const int N = 65;
int n;
ll b[N];
void ins(ll x)
{
for(int i = 62; i >= 0; i --) {
if(x >> i & 1) {
if(!b[i]) {
b[i] = x;
return;
}
else x ^= b[i];
}
}
}
ll find_max()
{
ll ans = 0;
for(int i = 62; i >= 0; i --) {
ans = max(ans, ans ^ b[i]);
}
return ans;
}
int main()
{
int T;
scanf("%d", &T);
while(T --) {
scanf("%d", &n);
memset(b, 0, sizeof b);
for(int i = 1; i <= n; i ++) {
ll x;
scanf("%lld", &x);
ins(x);
}
ll ans = find_max();
printf("%lld\n", ans);
}
return 0;
}