-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1360C.c
More file actions
45 lines (45 loc) · 983 Bytes
/
Copy path1360C.c
File metadata and controls
45 lines (45 loc) · 983 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
#include<stdio.h>
int main(){
int t,n;
scanf("%d",&t);
for(int i=0;i<t;i++){
scanf("%d",&n);
int a[n];
int flag1=0,flag2=0;
for(int j=0;j<n;j++){
scanf("%d",&a[j]);
if(a[j]%2==0){
flag1++;
}
else{
flag2++;
}
}
if(flag1==0 || flag2==0){
printf("YES\n");
}
else if(flag1%2==0 && flag2%2==0){
printf("YES\n");
}
else{
int count=0;
for(int x=0;x<n;x++){
for(int y=0;y<n;y++){
if(a[x]-a[y]==1){
count=1;
}
if(a[y]-a[x]==1){
count=1;
}
}
}
if(count==1){
printf("YES\n");
}
else{
printf("NO\n");
}
}
}
return 0;
}