QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#41422 | #4446. Link is as bear | L1ngYu | WA | 138ms | 11804kb | C++20 | 1.1kb | 2022-07-30 16:05:32 | 2022-07-30 16:05:35 |
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
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;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 138ms
memory: 11804kb
input:
22222 100000 595189703884863 72716684812661 449525802123580 504421888022388 390139608591346 108895143840760 170477720052912 185583843894744 201608404318832 128831549357316 521084715261656 668960191579878 573530403227342 489014525501629 56366633717911 1705111713690 227582321537214 710815946393065 169...
output:
2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 214...
result:
wrong answer 1st lines differ - expected: '1125899906842623', found: '2147483647'