This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 200'010;
int odd[N], even[N];
int *arr[2] = {even, odd};
int n, q;
template<int a[N]>
__attribute__((optimize("O3,unroll-loops"),target("avx")))
int get(int l, int r)
{
int ans = 0;
Loop (i,l,r)
ans ^= a[i];
return ans;
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
cin >> n >> q;
Loop (i,0,n)
cin >> arr[i&1][i/2];
while (q--) {
int t, x, y;
cin >> t >> x >> y;
if (t == 1) {
--x;
arr[x&1][x/2] = y;
}
if (t == 2) {
--x; --y;
if (x%2 != y%2)
cout << "0\n";
else if (x%2 == 0)
cout << get<even>(x/2, y/2+1) << '\n';
else
cout << get<odd>(x/2, y/2+1) << '\n';
}
}
}
# | 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... |