Task: | Xor sum |
Sender: | ashum-ta |
Submission time: | 2024-09-23 16:54:16 +0300 |
Language: | C++ (C++20) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare] 21 | for(int i=0; i<n; i++){ | ~^~ input/code.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'ull' {aka 'long long unsigned int'} [-Wsign-compare] 26 | for (int i = 0; i < q; ++i) { | ~~^~~ input/code.cpp:32:28: error: expected ';' before '}' token 32 | cout << sum << "\n" | ^ | ; 33 | } | ~
Code
#pragma GCC optimize("Ofast")#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")#include <bits/stdc++.h>using namespace std;typedef unsigned long long ull;const int MAXN = (int)1e5 + 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; a <= b - 1; ++j) {sum ^= xs[j];}cout << sum << "\n"}return 0;}