-
Notifications
You must be signed in to change notification settings - Fork 2
/
1296A.cpp
47 lines (42 loc) · 834 Bytes
/
1296A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Author: Rushi Vachhani
* Platform: Codeforces
* Problem_ID: 1296A
* Language: C++
*/
#include<bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
int arr[n], sum=0, odd_present=false, even_present = false;
for(int i=0; i<n; i++) {
cin >> arr[i];
if(arr[i]%2!=0){
odd_present = true;
}
else {
even_present = true;
}
}
if(accumulate(arr, arr+n, sum)%2!=0) { cout<<"YES\n"; return; }
else {
if(odd_present==true && even_present==true) {
cout<<"YES\n";
return;
}
else {
cout<<"NO\n";
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--) {
solve();
}
return 0;
}