Saleh127

codeforces 1360C.cpp

May 25th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define loop(i,c) for(i=0;i<c;i++)
  6. int main()
  7. {
  8. ll a[10000],c,d,e,o,f,i,j,k,l;
  9. test
  10. {
  11. e=0,o=0,d=0;
  12. cin>>c;
  13. loop(i,c)
  14. {
  15. cin>>a[i];
  16. if(a[i]%2) o++;
  17. else e++;
  18. }
  19. if(o%2==0 && e%2==0) printf("YES\n");
  20. else if(o%2==1 && e%2==0) printf("NO\n");
  21. else if(o%2==0 && e%2==1) printf("NO\n");
  22. else
  23. {
  24. sort(a,a+c);
  25. for(i=0;i<c-1;i++)
  26. {
  27. if(a[i+1]-a[i]==1)
  28. {
  29. d=1;
  30. break;
  31. }
  32. }
  33. if(d) printf("YES\n");
  34. else printf("NO\n");
  35. }
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment