QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#48588#4389. CopylqhsmashWA 132ms5448kbC++111.6kb2022-09-14 16:43:472022-09-14 16:43:49

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-14 16:43:49]
  • 评测
  • 测评结果:WA
  • 用时:132ms
  • 内存:5448kb
  • [2022-09-14 16:43:47]
  • 提交

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)) << (l - 1);
                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;
}

详细

Test #1:

score: 0
Wrong Answer
time: 132ms
memory: 5448kb

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:

23289232
512930102

result:

wrong answer 1st lines differ - expected: '28631531', found: '23289232'