/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Accepted 4ms 328.0 KiB

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-10-03 13:51:46
Judged By
Score
100
Total Time
4ms
Peak Memory
332.0 KiB