Submission #1283653

#TimeUsernameProblemLanguageResultExecution timeMemory
1283653VMaksimoski008XORanges (eJOI19_xoranges)C11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

struct fenwick {
    int n;
    vector<int> tree;

    void init(int _n) {
        n = _n + 10;
        tree.resize(n+10);
    }

    void update(int p, int v) {
        for(p++; p<n; p+=p&-p) tree[p] ^= v;
    }

    int query(int p) {
        int ans = 0;
        for(p++; p; p-=p&-p) ans ^= tree[p];
        return ans;
    }

    int query(int l, int r) {
        return query(r) ^ query(l-1);
    }
};

signed main() {
    ios_base::sync_with_stdio(false);
    cout.tie(0); cin.tie(0);

    int n, q; cin >> n >> q;
    vector<int> a(n+1);
    for(int i=1; i<=n; i++) cin >> a[i];

    fenwick fwt[2];
    fwt[0].init(n);
    fwt[1].init(n);

    for(int i=1; i<=n; i++)
        fwt[i&1].update(i, a[i]);

    while(q--) {
        int t, l, r; cin >> t >> l >> r;

        if(t == 1) {
            fwt[l&1].update(l, a[l]^r);
            a[l] = r;
        } else {
            cout << ((r-l) % 2 ? 0 : fwt[l&1].query(l, r)) << '\n';
        }
    }
}

Compilation message (stderr)

xoranges.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.