Code
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n,ctr=0;
cin >> n;
int arr[n];
for(int i=0;i<n;i++)
{
cin >> arr[i];
}
sort(arr,arr+n);
for(int i=0;i<n-1;i++)
{
if(arr[i]+1!=arr[i+1])
{
ctr++;
}
}
if(ctr==0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1055 Array Permutation
- Contest
- Brain Booster #3
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-05-06 15:16:48
- Judged At
- 2024-11-11 03:34:49
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 348.0 KiB