Guest User

Solution

a guest
May 14th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define endl "\n"
  5.  
  6. int main() {
  7.     ios_base :: sync_with_stdio(false);
  8.     //freopen("input.txt", "r", stdin);
  9.     //freopen("output.txt", "w", stdout)
  10.  
  11.     int t, n;
  12.     cin >> t;
  13.  
  14.     while(t--) {
  15.         cin >> n;
  16.         int a[n], deg_sum = 0;
  17.         bool deg_error = false;
  18.         for(int i = 0; i < n; i++) {
  19.             cin >> a[i];
  20.             if(a[i] > n-1) deg_error = true;
  21.             deg_sum += a[i];
  22.         }
  23.  
  24.         if(deg_sum % 2 == 0 && !deg_error) cout << "YES" << endl;
  25.         else cout << "NO" << endl;
  26.     }
  27. }
Add Comment
Please, Sign In to add comment