n = int(input())
x = []
for i in range(0, n):
m = int(input())
z = input().split()
x.append(z)
for i in range(0, len(x)):
for j in range(0, len(x[i])):
x[i][j] = int(x[i][j])
x[i].sort()
x[i].reverse()
for i in range(0, len(x)):
if len(x[i]) == 1:
if x[i][0]!=1:
print("NO")
else:
print("YES")
elif (x[i][0] - x[i][1]) > 1:
print("NO")
else:
print("YES")
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
long long n,mx=INT_MIN;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
if(arr[i]>mx)
mx=arr[i];
}
if(n==1){
if(arr[0]==1)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
else{
sort(arr,arr+n);
for(int i=n-1;i>=0;i--){
if(arr[i]-arr[i-1]<2){
cout<<"yes"<<endl;
break;
}
else{
cout<<"no"<<endl;
break;
}
}
}
}
}
762C - Two strings | 802M - April Fools' Problem (easy) |
577B - Modulo Sum | 1555B - Two Tables |
1686A - Everything Everywhere All But One | 1469B - Red and Blue |
1257B - Magic Stick | 18C - Stripe |
1203B - Equal Rectangles | 1536A - Omkar and Bad Story |
1509A - Average Height | 1506C - Double-ended Strings |
340A - The Wall | 377A - Maze |
500A - New Year Transportation | 908D - New Year and Arbitrary Arrangement |
199A - Hexadecimal's theorem | 519C - A and B and Team Training |
631A - Interview | 961B - Lecture Sleep |
522A - Reposts | 1166D - Cute Sequences |
1176A - Divide it | 1527A - And Then There Were K |
1618E - Singers' Tour | 1560B - Who's Opposite |
182B - Vasya's Calendar | 934A - A Compatible Pair |
1618F - Reverse | 1684C - Column Swapping |