| Task: | Xor sum |
| Sender: | aalto26dm_030 |
| Submission time: | 2026-09-21 17:00:27 +0300 |
| Language: | C++ (C++23) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <iostream>
#include <vector>
#include <string>
int main(int argc, char** argv) {
int n, q;
std::cin >> n >> q;
std::vector<int> numbers(n, 0);
std::vector<int> xor_until_n(n+2, 0);
for (int i=0; i<n; i++) {
int m;
std::cin >> m;
numbers.at(i) = m;
if (i == 1) {
xor_until_n.at(i) = numbers.at(i-1) ^ numbers.at(i);
} else if (i > 1) {
xor_until_n.at(i) = xor_until_n.at(i-1) ^ numbers.at(i);
}
}
std::string result;
for (int i=0; i<q; i++) {
int a, b;
std::cin >> a >> b;
int r = xor_until_n.at(b) - xor_until_n.at(a);
result = result + std::to_string(r) + '\n';
}
std::cout << result << std::endl;
return 0;
}
Test details
Test 1
Verdict: WRONG ANSWER
| 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 |
|---|
| 0 4 2 0 7 ... |
Feedback: Incorrect character on line 1 col 1: expected "7", got "0"
Test 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 200000 921726510 307633388 992247073 ... |
| correct output |
|---|
| 834756431 130379787 403037296 308618218 784778243 ... |
| user output |
|---|
| (empty) |
