CSES - Aalto Competitive Programming 2024 - wk4 - Mon - Results
Submission details
Task:Xor sum
Sender:ashum-ta
Submission time:2024-09-23 16:58:49 +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:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0; i<n; i++){
      |                  ~^~
input/code.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare]
   27 |     for (int i = 0; i < q; ++i) {
      |                     ~~^~~

Code

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int MAXN = (int)2e5 + 1;
int xs[MAXN];
int main(){
ull n, q;
ios::sync_with_stdio(false);
cout.tie(0);
cin >> n >> q;
for(int i=0; i<n; i++){
cin >> xs[i];
}
int a, b;
for (int i = 0; i < q; ++i) {
cin >> a >> b;
int sum = 0;
for (int j = a - 1; j <= b - 1; ++j) {
sum ^= xs[j];
}
cout << sum << "\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:

input
200000 200000
921726510 307633388 992247073 ...

correct output
834756431
130379787
403037296
308618218
784778243
...

user output
(empty)