Submission #979454

# Submission time Handle Problem Language Result Execution time Memory
979454 2024-05-11T03:47:46 Z LOLOLO XORanges (eJOI19_xoranges) C++17
0 / 100
13 ms 8796 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
#define           f     first
#define           s     second
#define           pb    push_back
#define           ep    emplace
#define           eb    emplace_back
#define           lb    lower_bound
#define           ub    upper_bound
#define       all(x)    x.begin(), x.end()
#define      rall(x)    x.rbegin(), x.rend()
#define   uniquev(v)    sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define     mem(f,x)    memset(f , x , sizeof(f))
#define        sz(x)    (int)(x).size()
#define  __lcm(a, b)    (1ll * ((a) / __gcd((a), (b))) * (b))
#define          mxx    *max_element
#define          mnn    *min_element
#define    cntbit(x)    __builtin_popcountll(x)
#define       len(x)    (int)(x.length())
 
const int N = 1e5 + 10;

struct fen{
    vector <ll> f;
    int N;
    void ass(int n) {
        N = n + 100;
        f.assign(N + 1, 0);
    }

    void upd(int i, ll x) {
        for (;i; i -= i & (-i))
            f[i] ^= x;
    }

    ll get(int i) {
        ll s = 0;
        for (; i <= N; i += i & (-i))
            s ^= f[i];

        return s;
    }
};

int a[N];

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

    int n, q;
    cin >> n >> q;

    fen f1, f0;
    f1.ass(n + 1);
    f0.ass(n + 1);

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (i % 2) {
            f1.upd(i, a[i]);
        } else {
            f0.upd(i, a[i]);
        }
    }

    for (int i = 1; i <= q; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        if (t == 1) {
            if (x % 2) {
                f1.upd(x, y ^ a[x]);
            } else {
                f0.upd(x, y ^ a[x]);
            }

            a[x] = y;
        }

        if (t == 2) {
            if (x % 2) {
                cout << (f1.get(x) ^ f1.get(y + 1)) << '\n';
            } else {
                cout << (f0.get(x) ^ f0.get(y + 1)) << '\n';
            }
        }
    }
} 
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 8796 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -