제출 #649469

#제출 시각아이디문제언어결과실행 시간메모리
649469ymmXORanges (eJOI19_xoranges)C++17
55 / 100
1057 ms7220 KiB
#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 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...