Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- int main() {
- int t;
- cin>>t;
- while(t--)
- {
- int n;
- cin>>n;
- vector<int> a(n);
- for(auto &e: a)
- cin>>e;
- ll int tot = accumulate(a.begin(), a.end(), 0);
- if(tot%n != 0)
- {
- cout<<"No\n";
- continue;
- }
- int avg = tot/n;
- int f = 1;
- for(auto e: a)
- f &= (abs(e - avg)%2 == 0);
- if(f) cout<<"Yes\n";
- else cout<<"No\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment