1857A - Array Coloring - CodeForces Solution


greedy math

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define read(x) ll x; cin >> x
#define endll '\n'
#define print(x) cout << x << endll
#define py cout << "YES\n"
#define pn cout << "NO\n"
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define frr(i, a, b) for (ll i = b; i >= a; i--)
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define vecp(v) for (auto i : v) cout << i << ' '; cout << endll
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef set<ll> stll;
typedef map<ll, ll> mpll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vll v(n);
        ll odd=0;
        fr(i,0,n){
            cin>>v[i];
            if(v[i]%2!=0){
                odd++;
            }
            

        }
         if(odd %2==0 ){
               py<<endl;
              
        }
        else{
            pn<<endl;
        }

    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

455A - Boredom
1099A - Snowball
1651D - Nearest Excluded Points
599A - Patrick and Shopping
237A - Free Cash
1615B - And It's Non-Zero
1619E - MEX and Increments
34B - Sale
1436A - Reorder
1363C - Game On Leaves
1373C - Pluses and Minuses
1173B - Nauuo and Chess
318B - Strings of Power
1625A - Ancient Civilization
864A - Fair Game
1663B - Mike's Sequence
448A - Rewards
1622A - Construct a Rectangle
1620A - Equal or Not Equal
1517A - Sum of 2050
620A - Professor GukiZ's Robot
1342A - Road To Zero
1520A - Do Not Be Distracted
352A - Jeff and Digits
1327A - Sum of Odd Integers
1276A - As Simple as One and Two
812C - Sagheer and Nubian Market
272A - Dima and Friends
1352C - K-th Not Divisible by n
545C - Woodcutters