-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2050B.cpp
More file actions
33 lines (27 loc) · 686 Bytes
/
2050B.cpp
File metadata and controls
33 lines (27 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t; cin >> t;
while (t--) {
int n; cin >> n;
ll sum1 = 0, sum2 = 0;
for (int i = 0; i < n; i++) {
int temp; cin >> temp;
if (i % 2 == 0)
sum1 += temp;
else
sum2 += temp;
}
int count1 = (n + 1) / 2;
int count2 = n / 2;
if ((sum1 / count1 == sum2 / count2) &&
(sum1 % count1 == 0) && (sum2 % count2 == 0))
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}