QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197283 | #4446. Link is as bear | yiyiyi# | AC ✓ | 206ms | 3564kb | C++14 | 1.0kb | 2023-10-02 14:02:46 | 2023-10-02 14:02:46 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f
#define re register
#define N 200203
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int mo=1000000007;
struct bit{
int a[64];
const int m=63;
bit(){memset(a,0,sizeof(a));}
bool ins(int x){
for (int i=m;~i;--i)
if (x&(1ll<<i))
if (!a[i]){a[i]=x;return 1;}
else x^=a[i];
return 0;
}
bool check(int x){
for (int i=m;~i;--i)
if (x&(1ll<<i))
if (!a[i])return 0;
else x^=a[i];
return 1;
}
int getmx(){
int res=0;
for (int i=m;~i;--i)
if ((res^a[i])>res)
res^=a[i];
return res;
}
}b;
inline int read(){
int x=0,w=0;char ch=getchar();
while (!isdigit(ch))w|=ch=='-',ch=getchar();
while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
return w?-x:x;
}
void solve(){
memset(b.a,0,sizeof(b.a));
int n=read(),ans=0,xo=0;
for (int i=1;i<=n;++i)b.ins(read());
cout<<b.getmx()<<endl;
}
signed main(){
int T=read();
while (T--)solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 206ms
memory: 3564kb
input:
22222 100000 595189703884863 72716684812661 449525802123580 504421888022388 390139608591346 108895143840760 170477720052912 185583843894744 201608404318832 128831549357316 521084715261656 668960191579878 573530403227342 489014525501629 56366633717911 1705111713690 227582321537214 710815946393065 169...
output:
1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 1125899906842623 11258999068...
result:
ok 22222 lines