-
Notifications
You must be signed in to change notification settings - Fork 0
/
spoj_kuruk14(i).cpp
70 lines (49 loc) · 1.08 KB
/
spoj_kuruk14(i).cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include<iostream>
#define fr(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define fr1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
#define frr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
#define ll long long
#define mod 1000000007
#define MAX 100000
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
using namespace std;
int main()
{
ll i,j,m,n,t,k,p,flag=0;
cin>>t;
while(t--)
{
cin>>n;
flag=0;
ll a[n],b[n];
fr(i,n)
{b[i]=0;}
for(i =0; i<n; i++)
{
cin>>a[i];
b[a[i]]++;
}
//p=*max_element(a,a+n);
fr(i,n)
{
if((b[i]+b[n-1-i])==2)
flag=0;
else
{
flag=1;break;
}
if(n%2==1)
{
if(b[n/2]==1)
flag=0;
else{
flag=1;break;}
}
}
if(flag==0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
}