Code
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(){
int n; cin>>n;
int hsh[n+1];
for(int i=0; i<n; i++){
hsh[i+1] = 0;
}
for(int i=0;i<n; i++){
int x; cin>>x;
hsh[x]+=1;
}
int flag =1;
for(int i=1; i<=n; i++) if(hsh[i] !=1) flag =-1;
if(flag == 1) cout<<"YES"<<"\n";
else cout<<"NO"<<"\n";
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t; cin>>t;
while(t--){
solve();
}
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:41
- Judged At
- 2024-11-11 03:35:12
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 764.0 KiB