Skip to content

Instantly share code, notes, and snippets.

@tony9402
Last active March 13, 2020 16:36
Show Gist options
  • Save tony9402/8702bb3e9af8b20dd54ebe80b19b313d to your computer and use it in GitHub Desktop.
Save tony9402/8702bb3e9af8b20dd54ebe80b19b313d to your computer and use it in GitHub Desktop.
Codeforces
#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