Last active
March 13, 2020 16:36
-
-
Save tony9402/8702bb3e9af8b20dd54ebe80b19b313d to your computer and use it in GitHub Desktop.
Codeforces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define endl "\n"; | |
using namespace std; | |
typedef long long ll; | |
int arr[200001], inf = 1000000000; | |
int main() { | |
ios::sync_with_stdio(false); | |
cin.tie(0); | |
int t; cin >> t; | |
while (t--) { | |
int n, maxi=0; | |
cin >> n; | |
vector<int> vc; | |
for (int i = 0; i < n; i++) { | |
int x; cin >> x; | |
maxi = max(maxi, x); | |
vc.push_back(x); | |
} | |
bool ans = true; | |
for (int i = 0; ans && i < n; i++) { | |
if ((maxi - vc[i]) % 2)ans = false; | |
} | |
if (ans) { cout << "YES" << endl; } | |
else {cout << "NO" << endl;} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment