답안 #964674

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964674 2024-04-17T10:18:17 Z pcc XORanges (eJOI19_xoranges) C++17
38 / 100
86 ms 9000 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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2404 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 9000 KB Output is correct
2 Correct 79 ms 8752 KB Output is correct
3 Correct 77 ms 8812 KB Output is correct
4 Correct 86 ms 8276 KB Output is correct
5 Correct 80 ms 8320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -