Submission #1113939

# Submission time Handle Problem Language Result Execution time Memory
1113939 2024-11-17T21:25:53 Z Dan4Life XORanges (eJOI19_xoranges) C++17
0 / 100
493 ms 9296 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 << (sum(r)^sum(l-1-(r%2==l%2))) << "\n";
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 493 ms 9296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -