-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.cpp
More file actions
42 lines (29 loc) · 649 Bytes
/
Copy pathA.cpp
File metadata and controls
42 lines (29 loc) · 649 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
34
35
36
37
38
39
40
41
42
#include<bits/stdc++.h>
using namespace std;
//directives
#define pb push_back
#define int long long
#define ss second
#define ff first
void solve(){
int n; cin>>n;
vector<int> arr(n);
for(int i=0; i<n; i++) cin>>arr[i];
sort(arr.rbegin(), arr.rend());
for(int i=1; i<n-1; i++){
int a = arr[i-1], b = arr[i], c = arr[i+1];
if(3*b - 2*a == c) continue;
if(3*b - a == 2*c) continue;
cout<<"No"<<endl;
return;
}
cout<<"Yes"<<endl;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int t=1;
cin>>t;
while(t--) solve();
return 0;
}