Code
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
int n, ok = 1;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) cin >> a[i];
sort(a.begin(), a.end());
for (int i = 1; i <= n; i++) if (a[i] != i) ok = 0;
cout << (ok ? "YES" : "NO") << endl;
}
}
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:18:33
- Judged At
- 2024-11-11 03:34:46
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 536.0 KiB