Submission #787164

# Submission time Handle Problem Language Result Execution time Memory
787164 2023-07-18T21:51:30 Z ThylOne XORanges (eJOI19_xoranges) C++14
38 / 100
405 ms 9400 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long
signed main(){
	int n;cin>>n;
	int q;cin>>q;
	vector<int> nums(n);
	for(int i = 0 ; i < n ; i++){
		cin>>nums[i];
	}
	int XorPref[n];
	
	int acts[2] = {0,0};
	for(int i = 0;i<n;i++){
		acts[i%2]^=nums[i];
		XorPref[i]=acts[i%2];
	}
	
	for(int _=0;_<q;_++){
		int type;cin>>type;
		if(type==1){
			int pos;cin>>pos;pos--;
			int val;cin>>val;
			nums[pos]=val;
		}else{
			int l,r;cin>>l>>r;
			l--;r--;
			if(((r-l)&1)){
				cout<<0<<endl;
			}else{
				if((l-2)<0){
					int ans = XorPref[r];
					cout<<ans<<endl;
				}else{
					int ans = XorPref[r]^XorPref[l-2];
					cout<<ans<<endl;
				}
			
				
			}
			
		}
	}
	return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 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
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 385 ms 4508 KB Output is correct
2 Correct 381 ms 9400 KB Output is correct
3 Correct 385 ms 9380 KB Output is correct
4 Correct 392 ms 9068 KB Output is correct
5 Correct 405 ms 9120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -