| Task: | Xor sum |
| Sender: | Abduvohid |
| Submission time: | 2025-09-22 16:24:50 +0300 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | ACCEPTED | 0.09 s | details |
Code
// g++ -std=c++17 -O2 -pipe -Wall -Wextra a.cpp -o a
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1'000'000'007;
const int INF = 1e9;
#define ll long long
#define fast \
ios::sync_with_stdio(false); \
cin.tie(nullptr);
int main()
{
fast;
ll n, q;
cin >> n >> q;
vector<ll> prefixX(n + 1, 0);
ll x;
for (int i = 1; i <= n; i++)
{
cin >> x;
prefixX[i] = prefixX[i - 1] ^ x;
}
ll l, r;
while (q--)
{
cin >> l >> r;
cout << (prefixX[r] ^ prefixX[l - 1]) << '\n';
}
return 0;
}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 |
