Submission #964676

# Submission time Handle Problem Language Result Execution time Memory
964676 2024-04-17T10:19:12 Z pcc XORanges (eJOI19_xoranges) C++17
38 / 100
76 ms 3920 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 2e5+10;

struct BIT{
	int bit[mxn];
	BIT(){}
	void modify(int p,int v){
		for(;p<mxn;p+=p&-p)bit[p] ^= v;
		return;
	}
	int getval(int s,int e){
		int re = 0;
		for(;e>0;e-= e&-e)re ^= bit[e];
		s--;
		for(;s>0;s-= s&-s)re ^= bit[s];
		return re;
	}
};

BIT od,ev;
int N,Q;
int arr[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>Q;
	for(int i = 1;i<=N;i++){
		cin>>arr[i];
		if(i&1)od.modify(i,arr[i]);
		else ev.modify(i,arr[i]);
	}
	while(Q--){
		int t,a,b;
		cin>>t>>a>>b;
		if(t == 1){
			if(a&1)od.modify(a,(arr[a] ^= b));
			else ev.modify(a,(arr[a]^=b));
		}
		else{
			if((b-a+1)%2 == 0)cout<<"0\n";
			else if(a&1)cout<<od.getval(a,b)<<'\n';
			else cout<<ev.getval(a,b)<<'\n';
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 3788 KB Output is correct
2 Correct 67 ms 3740 KB Output is correct
3 Correct 76 ms 3872 KB Output is correct
4 Correct 60 ms 3796 KB Output is correct
5 Correct 60 ms 3920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -