记录编号 |
204199 |
评测结果 |
AAAAAAAAAA |
题目名称 |
平凡的数据范围 |
最终得分 |
100 |
用户昵称 |
dashgua |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.011 s |
提交时间 |
2015-11-03 23:26:14 |
内存使用 |
0.39 MiB |
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <iostream>
#include <algorithm>
template<class Num>void read(Num &x)
{
char c; int flag = 1;
while((c = getchar()) < '0' || c > '9')
if(c == '-') flag *= -1;
x = c - '0';
while((c = getchar()) >= '0' && c <= '9')
x = (x<<3) + (x<<1) + (c-'0');
x *= flag;
return;
}
template<class Num>void write(Num x)
{
if(!x) {putchar('0');return;}
if(x < 0) putchar('-'), x = -x;
static char s[20];int sl = 0;
while(x) s[sl++] = x%10 + '0',x /= 10;
while(sl) putchar(s[--sl]);
}
const int maxn = 10030, size = 100;
int N, bs;
long long a[maxn], b[size], ans;
int main()
{
freopen("xor_equ.in","r",stdin);
freopen("xor_equ.out","w",stdout);
read(N);
for(int i = 1; i <= N; i++) read(a[i]);
for(int i = 63; i >= 0; i--)
{
bool flag = false;
for(int j = 1; j <= N; j++)
if((a[j] >> i) & 1)
{
flag = true;
b[++bs] = a[j];
break;
}
if(!flag) continue;
for(int j = 1; j <= N; j++)
if((a[j] >> i) & 1) a[j] ^= b[bs];
for(int j = 1; j < bs; j++)
if((b[j] >> i) & 1) b[j] ^= b[bs];
}
for(int i = 1; i <= bs; i++) ans ^= b[i];
write(ans);
fclose(stdin);
fclose(stdout);
return 0;
}