Task: | Xor sum |
Sender: | htoik |
Submission time: | 2024-09-23 17:09:57 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.52 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:13:19: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare] 13 | for(int i=0; i<n; i++){ | ~^~
Code
#include <bits/stdc++.h>using namespace std;typedef unsigned long long ull;int main(){ull n, q;std::cin >> n >> q;vector<ull> xs2;xs2.reserve(n);ull x2 = 0;xs2.push_back(0);for(int i=0; i<n; i++){ull x;cin >> x;x2 ^= x;xs2.push_back(x2);}for(ull i=0; i<q; i++){ull a, b;cin >> a >> b;ull sum = xs2[a-1] ^ xs2[b];cout << sum << endl;}}
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 |