Code
/**
* Author : Shafi
*
***/
#include <iostream>
#include "vector"
#include "algorithm"
using namespace std;
int main() {
// Write C++ code here
int tc;
cin>>tc;
while(tc--){
int n;
cin>>n;
vector<int>v(n);
for(auto &it:v){
cin>>it;
}
sort(v.begin(),v.end());
string ans = "YES";
for(int i=0;i<n;i++){
if(v[i] != i+1){
ans = "NO";
break;
}
}
cout<<ans<<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:23:09
- Judged At
- 2024-11-11 03:34:36
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 320.0 KiB