| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1210080 | sunflower | XORanges (eJOI19_xoranges) | C++17 | 50 ms | 3996 KiB | 
#include <bits/stdc++.h>
using namespace std;
int n, q;
#define MAX_N 200'200
int a[MAX_N + 7];
struct BIT {
  int bit[MAX_N + 7];
  void update(int x, int v) {
    for (; x <= n; x += x & (-x)) bit[x] ^= v;
  }
  int get(int x) {
    int ans = 0;
    for (; x > 0; x -= x & (-x)) ans ^= bit[x];
    return ans;
  }
  int cal(int l, int r) {
    if (l > r) return 0;
    return get(r) ^ get(l - 1);
  }
} sumXor[2];
#undef MAX_N
int main() {
  ios_base::sync_with_stdio(false);cin.tie(nullptr);
  if (fopen("test.inp","r")) {
    freopen("test.inp","r",stdin);
    freopen("test.out","w",stdout);
  }
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) cin >> a[i];
//  for (int i = 1; i <= n; ++i) {
//    pre.update(i, a[i]);
//    sumXor.update(i, pre.get(i));
//  }
//  vector <int> _pre(n + 2, 0), _sumXor(n + 2, 0);
/// value of sumXor: xor of all i cung tinh chan le;
  for (int i = 1; i <= n; ++i) sumXor[i & 1].update(i, a[i]);
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int i, val;
      cin >> i >> val;
//      int pref = pre.get(pos);
//
//      pre.update(pos, a[pos] ^ val);
//
//      sumXor.update(pos, pre.get(pos) ^ pref);
      sumXor[i & 1].update(i, a[i] ^ val);
      a[i] = val;
//      _pre[0] = 0;
//      for (int i = 1; i <= n; ++i) _pre[i] = _pre[i - 1] ^ a[i];
//
//      _sumXor[0] = 0;
//      for (int i = 1; i <= n; ++i) _sumXor[i] = _sumXor[i - 1] ^ _pre[i];
    } else {
      int l, r;
      cin >> l >> r;
      int ans = 0;
      if ((r - l + 1) % 2 == 1) {
          ans = sumXor[r & 1].get(r) ^ sumXor[max(0, l - 2) & 1].get(l - 2);
      }
      cout << ans << "\n";
    }
  }
  return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
