QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#340543 | #4446. Link is as bear | Terac# | WA | 172ms | 7624kb | C++14 | 2.0kb | 2024-02-29 09:57:06 | 2024-02-29 09:57:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
namespace IO {
#if ONLINE_JUDGE
#define getc() (IS == IT && (IT = (IS = ibuf) + fread(ibuf, 1, IL, stdin), IS == IT) ? EOF : *IS++)
#else
#define getc() getchar()
#endif
const int IL = 1 << 21, OL = 1 << 21;
int olen = 0;
char ibuf[IL], *IS = ibuf, *IT = ibuf, obuf[OL];
inline int read() {
register char ch = getc(); register int x = 0, f = 1;
while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getc(); }
while(isdigit(ch)) x = x * 10 + ch - 48, ch = getc();
return x * f;
}
inline double readdb() {
register char ch = getc(); register double x = 0, f = 1;
while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getc(); }
while(isdigit(ch)) x = x * 10 + ch - 48, ch = getc();
if(ch == '.') {
register double b = 0.1;
ch = getc();
while(isdigit(ch)) x += (ch - 48) * b, b *= 0.1, ch = getc();
}
return x * f;
}
inline int readstr(char *s) {
register char ch = getc(); register int len = 0;
while(!isalpha(ch)) ch = getc();
while(isalpha(ch)) s[++len] = ch, ch = getc();
return len;
}
inline void flush() { fwrite(obuf, 1, olen, stdout); olen = 0; }
inline void putc(register char ch) { obuf[olen++] = ch; }
template<class T>
inline void write(register T x) {
if(x < 0) obuf[olen++] = '-', x = -x;
if(x > 9) write(x / 10);
obuf[olen++] = x % 10 + 48;
}
} using namespace IO;
const int N = 1e6 + 10;
int T, n, a[N], bas[55];
void insert(int x) {
for(int i = 0; i <= 50; i++)
if(!(x >> i & 1)) continue;
else {
if(bas[i]) x ^= bas[i];
else {
bas[i] = x;
break;
}
}
}
int qry() {
int res = 0;
for(int i = 50; ~i; i--)
if(res >> i & 1) continue;
else res ^= bas[i];
return res;
}
void MAIN() {
n = read();
memset(bas, 0, sizeof(bas));
for(int i = 1; i <= n; i++)
a[i] = read(), insert(a[i]);
printf("%lld\n", qry());
}
signed main() {
T = read();
while(T--) MAIN();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 172ms
memory: 7624kb
input:
22222 100000 595189703884863 72716684812661 449525802123580 504421888022388 390139608591346 108895143840760 170477720052912 185583843894744 201608404318832 128831549357316 521084715261656 668960191579878 573530403227342 489014525501629 56366633717911 1705111713690 227582321537214 710815946393065 169...
output:
511321240636753 422937404708971 567786303694827 829750425158321 386764458803525 512096488997183 505715882500447 615602755128785 1091309808411093 803867095105013 272084842280505 819010606127413 1094675217186847 1108654631758239 33037875074991 500787560781131 9940999416649 205741294638845 225274823986...
result:
wrong answer 1st lines differ - expected: '1125899906842623', found: '511321240636753'