Submission details
Task:Xor sum
Sender:anton_h
Submission time:2025-09-22 16:22:27 +0300
Language:C++ (C++20)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.09 sdetails

Code

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
using vl=vector<ll>;
#define all(c) begin(c),end(c)
#define pb push_back
#define sz(c) ll((c).size())

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

#define TR(x) ({ if(1) cout << __LINE__ << ": " #x " = " << (x) << endl; })

// Only when needed
using dd = double;
const dd eps = 1e-10;
using vd = vector<dd>;
using vvd = vector<vd>;
using vvl = vector<vl>;

void solve(){
	ll n, q; cin >> n >> q;
	vl a(n), pref(n + 1);
	for(ll &x : a) cin >> x;
	FOR(i, 0, n){
		pref[i + 1] = pref[i] ^ a[i];
	}
	FOR(i, 0, q){
		ll a, b; cin >> a >> b;
		a--;
		cout << (pref[b] ^ pref[a]) << "\n";
	}
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	 solve();
}

Test details

Test 1

Verdict: ACCEPTED

input
8 36
7 6 4 6 2 9 4 8
1 1
1 2
1 3
...

correct output
7
1
5
3
1
...

user output
7
1
5
3
1
...

Test 2

Verdict: ACCEPTED

input
200000 200000
921726510 307633388 992247073 ...

correct output
834756431
130379787
403037296
308618218
784778243
...

user output
834756431
130379787
403037296
308618218
784778243
...
Truncated