| Task: | Xor sum |
| Sender: | aalto26dm_028 |
| Submission time: | 2026-09-21 16:34:52 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.28 s | details |
Code
n, q = map(int, input().split())
arr = list(map(int, input().split()))
queries = []
for i in range(q):
a, b = map(int, input().split())
queries.append((a, b))
premade = [arr[0]]
for i in range(1, n):
premade.append(premade[i - 1] ^ arr[i])
for a, b in queries:
if a == 1:
print(premade[b - 1])
else:
print(premade[a - 2] ^ premade[b - 1])
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 ... |
