제출 #1307374

#제출 시각아이디문제언어결과실행 시간메모리
1307374ayazXORanges (eJOI19_xoranges)C++20
55 / 100
1096 ms2244 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#define line() "author : AyazN";
#endif

typedef long long ll;

#define all(x) (x).begin(), (x).end()
#define isz(x) (int)(x.size())
#define int ll

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int sz = 200500, inf = 1000000000;
const ll mod = 1000000007, INF = 1000000000000000000;

void precompute() {}
int a[sz];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
#ifdef LOCAL
  freopen("err.log", "w", stderr);
#endif
  precompute();
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int i, x;
      cin >> i >> x;
      a[i] = x;
    } else {
      int l, r;
      cin >> l >> r;
      if ((r - l + 1) & 1) {
        int ans = 0;
        for (int i = 1; i <= (r - l + 1); i++) {
          if (i & 1) {
            ans ^= a[l + i - 1];
          }
        }
        cout << ans << '\n';
      } else {
        cout << 0 << '\n';
      }
    }
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...