CSES - Aalto Competitive Programming 2024 - wk4 - Mon - Results
Submission details
Task:Xor sum
Sender:htoik
Submission time:2024-09-23 16:38:27 +0300
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2--details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:11:19: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare]
   11 |     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> xs;
    xs.reserve(n);
    for(int i=0; i<n; i++){
        ull x;
        cin >> x;
        xs.push_back(x);
    }

    for(ull i=0; i<q; i++){
        ull a, b;
        cin >> a >> b;
        ull sum = 0;
        for(ull j=a-1; j<=b-1; j++){
            sum ^= xs[j];
        }
        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:

input
200000 200000
921726510 307633388 992247073 ...

correct output
834756431
130379787
403037296
308618218
784778243
...

user output
(empty)