Submission #649469

# Submission time Handle Problem Language Result Execution time Memory
649469 2022-10-10T09:04:56 Z ymm XORanges (eJOI19_xoranges) C++17
55 / 100
1000 ms 7220 KB
#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
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 415 ms 7040 KB Output is correct
2 Correct 432 ms 7128 KB Output is correct
3 Correct 408 ms 7220 KB Output is correct
4 Execution timed out 1057 ms 6780 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 415 ms 7040 KB Output is correct
16 Correct 432 ms 7128 KB Output is correct
17 Correct 408 ms 7220 KB Output is correct
18 Execution timed out 1057 ms 6780 KB Time limit exceeded
19 Halted 0 ms 0 KB -