답안 #600982

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
600982 2022-07-21T09:48:20 Z Fidan XORanges (eJOI19_xoranges) C++17
38 / 100
499 ms 12572 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n, q, i;
	cin>>n>>q;
	vector<ll> a(n+1);
	vector<ll> b(n+1);
	vector<ll> T1(n+1, 0);
	vector<ll> T2(n+1, 0);
	
	for(i=1; i<=n; i++){
		ll x;
		cin>>x;
		if(i%2==0){
			a[i]=x;
			b[i]=0;
			T1[i]=(T1[i-1]^a[i]);
		}
		else{
			b[i]=x;
			a[i]=0;
		}
		T1[i]=(T1[i-1]^a[i]);
		T2[i]=(T2[i-1]^b[i]);
	}
	
	while(q--){
		int t;
		cin>>t;
		if(t==1){
			ll j, asdf;
			cin>>j>>asdf;
		}
		else{
			ll l, r;
			cin>>l>>r;
			if((r-l)%2==1) cout<<0<<endl;
			else{
				if(l%2==0){
					cout<<(T1[r]^T1[l-1])<<endl;
				}
				else{
					cout<<(T2[r]^T2[l-1])<<endl;
				}
			}
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 467 ms 12536 KB Output is correct
2 Correct 499 ms 12572 KB Output is correct
3 Correct 481 ms 12508 KB Output is correct
4 Correct 476 ms 12232 KB Output is correct
5 Correct 481 ms 12240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -