n = int(input())
for i in range(n):
k = int(input())
tests = list(map(int, input().split()))
tests.sort()
b = True
for j in range(1, len(tests)):
if abs(tests[j] - tests[j-1]) > 1:
b = False
break
if b:
print('YES')
else:
print('NO')
#include <bits/stdc++.h>
#define nmod(a, n) (a % n + n) % n
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define inF freopen("input.txt", "r", stdin);
#define outF freopen("output.txt", "w", stdout);
#define sortv(v) sort(v.begin(), v.end());
#define rev(v) reverse(v.begin(), v.end());
#define pb push_back
#define all(a) a.begin(), a.end()
#define vi vector<int>
#define vii vector<vector<int>>
#define ll long long
const double pi = acos(-1), eps = 1e-9;
template <typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &s)
{
for (auto const &i : s)
os << i << " ";
return os;
}
template <typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &s)
{
for (int i = 0; i < s.size(); i++)
is >> s[i];
return is;
}
using namespace std;
const int INF = 1e9;
void solve(){
int n ;
cin >> n ;
vector<int> v(n);
cin >> v ;
sortv(v);
for(int i = 1 ; i < n ; i ++ ){
if(v[i]-v[i-1]>1){
cout << "NO"<<endl;
return;
}
}
cout << "YES" << endl;
}
int main()
{
fastio;
int t;
cin >> t;
while (t--)
solve();
}
77. Combinations | 46. Permutations |
226. Invert Binary Tree | 112. Path Sum |
1556A - A Variety of Operations | 136. Single Number |
169. Majority Element | 119. Pascal's Triangle II |
409. Longest Palindrome | 1574A - Regular Bracket Sequences |
1574B - Combinatorics Homework | 1567A - Domino Disaster |
1593A - Elections | 1607A - Linear Keyboard |
EQUALCOIN Equal Coins | XOREQN Xor Equation |
MAKEPAL Weird Palindrome Making | HILLSEQ Hill Sequence |
MAXBRIDGE Maximise the bridges | WLDRPL Wildcard Replacement |
1221. Split a String in Balanced Strings | 1002. Find Common Characters |
1602A - Two Subsequences | 1555A - PizzaForces |
1607B - Odd Grasshopper | 1084A - The Fair Nut and Elevator |
1440B - Sum of Medians | 1032A - Kitchen Utensils |
1501B - Napoleon Cake | 1584B - Coloring Rectangles |