complete 18870.c

This commit is contained in:
2024-04-09 14:13:32 +09:00
parent 8745be138f
commit 1d136a8f38

View File

@@ -44,17 +44,14 @@ void compress(int N, Honeycomb *arr) {
}
qsort(arr, N, sizeof(Honeycomb), compare_loc);
return;
}
// C11(Clang)에서 런타임에러: 백준 clang에서 qsort가 정렬을 제대로 하지 못하는 문제
int main() {
int N;
scanf("%d", &N);
Honeycomb *arr;;
if ((arr = (Honeycomb *) calloc(N, sizeof(Honeycomb))) == NULL) {
printf("NULL");
return 1;
}
arr = (Honeycomb *) calloc(N, sizeof(Honeycomb));
for (int i = 0; i < N; i++) {
scanf("%d", &arr[i].x);
arr[i].loc = i;