My issue
sol.cpp: In function ‘int main()’:
sol.cpp:34:6: error: expected ‘}’ at end of input
34 | }
| ^
sol.cpp:6:12: note: to match this ‘{’
6 | int main() {
| ^
My code
#include <iostream>
#include <vector>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
bool possible = true;
for (int i = 0; i < n; i++) {
int next = (i + 1) % n;
if ((a[i] + a[next]) % 2!= 0) {
possible = false;
break;
}
}
if (possible) {
cout << "YES" << endl;
} else {
cout << "YES" << endl;
}
return 0;
}
Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/ADJSUMPAR