Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int N;
cin >> N;
int arr[N];
for (int n=0; n<N; n++)
{
cin >> arr[n];
}
sort(arr, arr+N);
bool flag = true;
for (int n=1; n<N; n++)
{
if (arr[n] - arr[n-1] != 1)
{
flag = false;
break;
}
}
if (flag)
{
cout << "YES";
}
else
{
cout << "NO";
}
cout << 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:34:27
- Judged At
- 2024-11-11 03:34:05
- Judged By
- Score
- 100
- Total Time
- 4ms
- Peak Memory
- 540.0 KiB