Runtime Error
Code
#include <stdio.h>
int main(){
int x = 0, t;
scanf("%d", &t);
while(x < t){
int n;
scanf("%d", &n);
int ara[n], ara2[n];
for (int i = 0; i < n; i++){
scanf("%d", &ara[i]);
}
int min, min_ind;
for(int i = 0; i < n; i++){
min = ara[i];
for(int j = 0; j < n; j++){
if(min > ara[j]){
min = ara[j];
min_ind = j;
}
}
ara2[i] = min;
ara[min_ind] = 100000;
}
//printf("%d %d %d", ara2[0], ara2[1], ara2[2]);
for(int i = 0; i < n; i++){
if(ara2[i] != i+1){
printf("NO\n");
goto Down;
}
}
printf("YES\n");
Down:
x++;
}
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 15:33:11
- Judged At
- 2024-11-11 03:34:07
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 324.0 KiB