Code
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define endl '\n'
#define Endl '\n'
using namespace std;
const int N = 2e5 + 5;
int tc, n, m, a[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); // cout.tie(0);
cin >> tc;
while (tc--) {
set<int> st;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
st.insert(a[i]);
}
if (*st.begin() == 1 && *st.end() == n && st.size() == n) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1055 Array Permutation
- Contest
- Brain Booster #3
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-05-06 15:07:31
- Judged At
- 2024-11-11 03:35:13
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 540.0 KiB