Code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;cin>>t;
while(t--){
int n;cin>>n;
vector<int>vl(n);
for(int i=0;i<n;i++)cin>>vl[i];
vector<int> vll(n+1,0);
bool flag = true;
for (int u: vl) {
if (u< 1 || u> n || vll[u] != 0) {
flag = false;
break;
}
vll[u]++;
}
if(flag)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:20:12
- Judged At
- 2024-11-11 03:34:40
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 328.0 KiB