fork download
  1. #include<bits/stdc++.h>
  2. #define endl "\n"
  3. using namespace std ;
  4. int main() {
  5. ios::sync_with_stdio(NULL) ;
  6. cin.tie(NULL) ;
  7. cout.tie(NULL) ;
  8. int t ;
  9. cin >> t ;
  10. while( t-- ) {
  11. int n, a ;
  12. cin >> n ;
  13. int sum = 0, cnt1 = 0, cnt2 = 0;
  14. for( int i = 0 ; i < n ; i++ ) {
  15. cin >> a ;
  16. sum += a ;
  17. if( a == 1 )
  18. cnt1++ ;
  19. else
  20. cnt2++ ;
  21. }
  22. if( sum % 2 == 1 )
  23. cout << "NO" << endl ;
  24. else {
  25. if( cnt2 % 2 == 0 )
  26. cout << "YES" << endl ;
  27. else {
  28. if( cnt1 > 0 )
  29. cout << "YES" << endl ;
  30. else
  31. cout << "NO" << endl ;
  32. }
  33. }
  34. }
  35. return 0 ;
  36. }
  37.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
Standard output is empty