QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#41441 | #4446. Link is as bear | L1ngYu | AC ✓ | 186ms | 11856kb | C++20 | 1.2kb | 2022-07-30 21:32:41 | 2022-07-30 21:32:43 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define forr(i,a) for(auto i:a)
#define rall(a) rbegin(a),rend(a)
#define all(a) begin(a),end(a)
#define pb emplace_back
#define int long long
using namespace std;
int p[70];
struct read
{
static const int M = 1 << 23;
char buf[M], *S = buf, *P = buf, c, l;
inline char gc() { return (S == P && (P = (S = buf) + fread(buf, 1, M, stdin), S == P) ? EOF : *S++); }
template<class T> read &operator>>(T &x)
{
for (c = 0;!isdigit(c);c = gc()) l = c;
for (x = 0;isdigit(c);c = gc()) x = x * 10 + (c & 15);
return x = (l ^ 45) ? x : -x, *this;
}
}Cin;
void get(int x)
{
for (int i = 63;~i;--i)
{
if (!(x >> i))continue;
if (!p[i]) { p[i] = x; break; }
x ^= p[i];
}
}
void solve()
{
memset(p, 0, sizeof(p));
int n, ret = 0, x; Cin >> n;
rep(i, 1, n) Cin >> x, get(x);
per(i, 63, 0) if ((ret xor p[i]) > ret) ret ^= p[i];
cout << ret << '\n';
}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
int _;for (Cin >> _; _--; ) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 186ms
memory: 11856kb
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