记录编号 |
203735 |
评测结果 |
AAAAAAAAAA |
题目名称 |
平凡的数据范围 |
最终得分 |
100 |
用户昵称 |
Chenyao2333 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.019 s |
提交时间 |
2015-11-03 16:02:02 |
内存使用 |
31.28 MiB |
显示代码纯文本
#include <cstdio>
#include <algorithm>
typedef long long LL;
using namespace std;
const int kN = 5e5+10;
int N;
bool a[65][kN];
LL gauss() {
LL ret = 0;
for (int i = 1; i <= 63; i++) {
int j = 0;
while (j <= N && !a[i][j]) j++;
if (j > N && !a[i][N+1]) {
ret |= 1ll << (63-i);
} else if (j <= N) {
ret |= 1ll << (63-i);
for (int k = i+1; k <= 63; k++) if (a[k][j]) {
for (int ii = 1; ii <= N+1; ii++) {
a[k][ii] ^= a[i][ii];
}
}
}
}
return ret;
}
int main() {
freopen("xor_equ.in", "r", stdin);
freopen("xor_equ.out", "w", stdout);
scanf("%d", &N);
for (int i = 1; i <= N; i++) {
LL x; scanf("%lld", &x);
for (int j = 62; j >= 0; j--) {
a[63-j][i] = bool(x & (1ll << j));
}
}
for (int i = 1; i <= 63; i++) a[i][N+1] = true;
LL ans = gauss();
printf("%lld", ans);
return 0;
}