Code
#include <bits/stdc++.h>
using namespace std;
int main(){
int T;
cin>> T;
while (T--)
{
int N;
cin >> N;
vector<int>A(N);
for(int i=0;i<N;i++){
cin >> A[i];
}
sort(A.begin(),A.end());
int count=0;
for(int i=0;i<N;i++){
if(A[i]==(i+1)){
count++;
}
}
if(count==N){
cout << "YES\n";
}
else{
cout << "NO\n";
}
}
}
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:15:36
- Judged At
- 2024-11-11 03:34:51
- Judged By
- Score
- 100
- Total Time
- 4ms
- Peak Memory
- 548.0 KiB