답안 #441413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
441413 2021-07-05T07:10:27 Z RaresFelix XORanges (eJOI19_xoranges) C++17
55 / 100
38 ms 5684 KB
#include <bits/stdc++.h>
#define MAXN 217171
#ifdef AICI
#define cin fi
#endif // AICI
using namespace std;
#ifdef AICI
ifstream fi("a.in");
#endif // AICI
int A[MAXN], n, q;

struct AINT
{
	int V[MAXN];
	void _u(int u, int s, int d, int p, int v)
	{
		if(d < p || p < s)return;
		if(s==d){
			V[u] = v;
			return;
		}
		_u(u*2, s, (s+d)/2, p, v);
		_u(u*2+1, (s+d)/2+1, d, p, v);
		V[u] = V[u*2] ^ V[u*2+1];
	}
	int _q(int u, int s, int d, int l, int r)
	{
		if(d < l || r < s)return 0;
		if(l <= s && d <= r)return V[u];
		return _q(u*2, s, (s+d)/2, l, r) ^ _q(u*2+1, (s+d)/2+1, d, l, r);
	}
	void setup(int delta)
	{
		for(int i = 1; i + delta <= n; i += 2)
			_u(1, 1, n, i+delta, A[i+delta]);
	}
} Pare, Impare;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
	cin >> n >> q;
	for(int i = 1; i <= n; ++i)
		cin >> A[i];
	Pare.setup(1);
	Impare.setup(0);
	int tip, a, b;
	for(int i = 1; i <= q; ++i){
		cin >> tip >> a >> b;
		if(tip == 1) {
			A[a] = b;
			if(a%2)Impare._u(1, 1, n, a, b);
			else Pare._u(1, 1, n, a, b);
		} else {
			if((a^b)&1){
				cout << "0\n";
			} else {
				if(a&1) cout << Impare._q(1, 1, n, a, b);
				else cout << Pare._q(1, 1, n, a, b);
				cout << "\n";
			}
		}
	}
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 4 ms 588 KB Output is correct
12 Correct 5 ms 616 KB Output is correct
13 Correct 4 ms 560 KB Output is correct
14 Correct 4 ms 548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 38 ms 5684 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 4 ms 588 KB Output is correct
12 Correct 5 ms 616 KB Output is correct
13 Correct 4 ms 560 KB Output is correct
14 Correct 4 ms 548 KB Output is correct
15 Runtime error 38 ms 5684 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -