QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#533389 | #4446. Link is as bear | xuzhihaodedie | AC ✓ | 250ms | 3576kb | C++20 | 876b | 2024-08-25 21:34:07 | 2024-08-25 21:34:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int,int>
#define lson 2*p
#define rson 2*p+1
#define x first
#define y second
const int N=5e5+10;
const int mod=1e9+7;
int a[N];
int d[65];
void insert(int x) {
for(int i=60;i>=0;i--) {
if(x>>i&1) {
if(d[i]) x^=d[i];
else {
d[i]=x;
return ;
}
}
}
}
int query() {
int ans=0;
for(int i=60;i>=0;i--) {
if((ans^d[i])>ans) ans^=d[i];
}
return ans;
}
void solve() {
int n;
cin>>n;
memset(d,0,sizeof d);
for(int i=1;i<=n;i++) {
int x;
cin>>x;
insert(x);
}
cout<<query()<<endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T=1;
cin>>T;
while(T--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 250ms
memory: 3576kb
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