QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#48592 | #4389. Copy | lqhsmash | WA | 143ms | 5356kb | C++11 | 1.6kb | 2022-09-14 16:58:17 | 2022-09-14 16:58:20 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 50;
int T, q, n, a[N];
bitset<N> ans;
struct node {
int op, x, y;
}qur[N];
int main() {
#ifdef LOCAL
clock_t c1 = clock();
freopen("in.in", "r", stdin);
freopen("out.out", "w", stdout);
#endif
// ===================================================
scanf ("%d", &T);
while (T --) {
scanf ("%d%d", &n, &q);
for (int i = 0; i < n; i ++) {
scanf ("%d", &a[i]);
}
ans.reset ();
for (int i = 1; i <= q; i ++) {
int op, x, l, r; scanf ("%d", &op);
if (op == 1) {
scanf ("%d%d", &l, &r);
qur[i] = {op, l, r};
}else {
scanf ("%d", &x);
qur[i] = {op, x};
}
}
for (int i = q; i >= 1; i --) {
int op = qur[i].op;
if (op == 1) {
int l = qur[i].x, r = qur[i].y;
bitset<N> f = ~((~bitset<N>(0)) << r);
bitset<N> g = (~bitset<N>(0)) << r;
g &= ans, g >>= (r - l + 1);
ans = g ^ (f & ans);
}else {
int x = qur[i].x;
ans[x].flip ();
}
}
int res = 0;
for (int i = 0; i < n; i ++)
if (ans[i]) res ^= a[i];
printf("%d\n", res);
}
// ===================================================
#ifdef LOCAL
cerr << "Time Used: " << clock() - c1 << "ms" << endl;
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 143ms
memory: 5356kb
input:
2 5 10 14138491 23289232 33892225 43531245 54436322 1 1 4 2 2 2 3 2 4 2 5 1 2 4 2 2 2 3 2 4 2 5 99990 99990 493133979 94198606 751145654 147404311 601524088 744747426 561746143 212260573 241231749 810352224 81276441 382492450 18779020 317505899 880615584 654793240 417574821 822313301 140569958 69317...
output:
47356922 980200812
result:
wrong answer 1st lines differ - expected: '28631531', found: '47356922'