-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1360C.cpp
More file actions
55 lines (48 loc) · 730 Bytes
/
1360C.cpp
File metadata and controls
55 lines (48 loc) · 730 Bytes
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
48
49
50
51
52
53
54
55
#include <bits/stdc++.h>
using namespace std;
#define vt vector
#define ll long long
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define en '\n'
void sol() {
int n;
cin >> n;
vector<int> v;
v.resize(n);
for(int i=0;i<n;++i) {
cin >> v[i];
}
int e=0, o=0;
for(int i=0;i<sz(v);++i) {
if(v[i]&1) {
o++;
} else {
e++;
}
}
if((e&1^1) && (o&1^1)) {
cout << "YES" << en;
return;
} else {
sort(all(v));
for(int i=1;i<sz(v);++i) {
if(v[i]-v[i-1]==1) {
cout << "YES" << en;
return;
}
}
cout << "NO" << en;
}
return;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int T = 1;
cin >> T;
while(T--) {
sol();
}
return 0;
}