Wrong Answer
Code
#include<stdio.h>
int main(){
int t;
scanf("%d",&t);
for(int i=0; i<t; i++){
int n;
int count=0;
int sum = 0;
int num_sum = 0;
scanf("%d",&n);
int arr[n];
for(int j=0; j<n; j++){
scanf("%d",&arr[j]);
}
for(int j=0; j<n-1; j++){
for(int k=j+1; k<n; k++){
if(arr[j]==arr[k]){
count++;
}
}
}
for(int m=1; m<n+1; m++){
num_sum+=m;
}
int big = 0;
for(int m=0; m<n; m++){
sum+=arr[m];
if(arr[m]>n){
big++;
}
}
if(count==0 && sum==num_sum && big==0){
printf("YES");
}else{
printf("NO");
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1055 Array Permutation
- Contest
- Brain Booster #3
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2024-05-06 16:16:39
- Judged At
- 2024-11-11 03:33:16
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 424.0 KiB