Codeforces Round 874 (Div. 3) 1833C - Vlad Building Beautiful Array Solution
Solution in C++:
- /// Author : AH_Tonmoy
- #include <bits/stdc++.h>
- using namespace std;
- int32_t main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int t;
- cin >> t;
- while (t--) {
- int n , x ;
- cin >> n ;
- int mn = 1e9+5 , ev = 0 , odd = 0 ;
- for ( int i = 0 ; i < n ; i++){
- cin >> x ;
- mn = min ( x , mn ) ;
- if ( x % 2 == 0){
- ev++;
- }
- }
- if (ev == n ) cout <<"YES"<<endl;
- else{
- if ( mn % 2 == 1 ) {
- cout <<"YES"<<endl;
- }
- else cout <<"NO"<<endl;
- }
- }
- return 0;
- }
No comments