0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00
Baoshuo Ren 2022-06-06 20:48:36 +08:00
parent 6cc4f14081
commit 74f0ad0207
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

45
AcWing/3164/3164.cpp Normal file
View File

@ -0,0 +1,45 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e5 + 5;
int n;
unsigned long long x, a[N], ans;
inline void insert(unsigned long long x) {
for (int i = 63; ~i; i--) {
if (x & (1ull << i)) {
if (a[i]) {
x ^= a[i];
} else {
a[i] = x;
return;
}
}
}
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
insert(x);
}
for (int i = 63; ~i; i--) {
if ((ans ^ a[i]) > ans) ans ^= a[i];
}
cout << ans << endl;
return 0;
}