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;
}
return 0;
}
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:17:14
- Judged At
- 2024-11-11 03:34:48
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 548.0 KiB