답안 #1113940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113940 2024-11-17T21:34:43 Z Dan4Life XORanges (eJOI19_xoranges) C++17
100 / 100
482 ms 8652 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
const int N = (int)3e5+10;
int n, q, x, fen[2][N];

void upd(int x, int v){
	x++; int t = x%2;
	for(; x < N; x+=x&-x) fen[t][x]^=v; 
}

int sum(int x){ 
	x++; int s = 0, t = x%2;
	for(; x>0; x-=x&-x) s^=fen[t][x];
	return s;
}

int main(){
	cin >> n >> q;
	for(int i = 1; i <= n; i++) cin >> x, upd(i,x);
	while(q--){
		int t,v,l,r; cin >> t;
		if(t==1) cin >> l >> v, upd(l,sum(l)^sum(l-2)), upd(l,v);
		else cin >> l >> r,cout << ((r-l+1)%2==0?0:(sum(r)^sum(l-1-(r%2==l%2)))) << "\n";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2384 KB Output is correct
2 Correct 2 ms 2384 KB Output is correct
3 Correct 2 ms 2384 KB Output is correct
4 Correct 3 ms 2384 KB Output is correct
5 Correct 3 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 2 ms 2384 KB Output is correct
7 Correct 2 ms 2384 KB Output is correct
8 Correct 2 ms 2384 KB Output is correct
9 Correct 3 ms 2384 KB Output is correct
10 Correct 3 ms 2384 KB Output is correct
11 Correct 11 ms 2640 KB Output is correct
12 Correct 14 ms 2676 KB Output is correct
13 Correct 12 ms 2656 KB Output is correct
14 Correct 11 ms 2640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 455 ms 3760 KB Output is correct
2 Correct 452 ms 8520 KB Output is correct
3 Correct 482 ms 8652 KB Output is correct
4 Correct 442 ms 8384 KB Output is correct
5 Correct 447 ms 8440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 2 ms 2384 KB Output is correct
7 Correct 2 ms 2384 KB Output is correct
8 Correct 2 ms 2384 KB Output is correct
9 Correct 3 ms 2384 KB Output is correct
10 Correct 3 ms 2384 KB Output is correct
11 Correct 11 ms 2640 KB Output is correct
12 Correct 14 ms 2676 KB Output is correct
13 Correct 12 ms 2656 KB Output is correct
14 Correct 11 ms 2640 KB Output is correct
15 Correct 455 ms 3760 KB Output is correct
16 Correct 452 ms 8520 KB Output is correct
17 Correct 482 ms 8652 KB Output is correct
18 Correct 442 ms 8384 KB Output is correct
19 Correct 447 ms 8440 KB Output is correct
20 Correct 348 ms 8288 KB Output is correct
21 Correct 326 ms 8440 KB Output is correct
22 Correct 326 ms 8264 KB Output is correct
23 Correct 431 ms 8264 KB Output is correct
24 Correct 434 ms 8264 KB Output is correct