Submission #74903634
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>struct uma_s {int id, T;};int cmp(const void* x, const void* y) {struct uma_s a = *(const struct uma_s*)x, b = *(const struct uma_s*)y;return (a.T > b.T) - (a.T < b.T);}int main(void) {int N, i;struct uma_s* uma;if (scanf("%d", &N) != 1 || N < 3) return 1;uma = malloc(sizeof(*uma) * N);if (uma == NULL) return 2;for (i = 0; i < N; i++) {if (scanf("%d", &uma[i].T) != 1) return 1;uma[i].id = i + 1;}qsort(uma, N, sizeof(*uma), cmp);printf("%d %d %d\n", uma[0].id, uma[1].id, uma[2].id);free(uma);return 0;}
#include <stdio.h>
#include <stdlib.h>
struct uma_s {
int id, T;
};
int cmp(const void* x, const void* y) {
struct uma_s a = *(const struct uma_s*)x, b = *(const struct uma_s*)y;
return (a.T > b.T) - (a.T < b.T);
}
int main(void) {
int N, i;
struct uma_s* uma;
if (scanf("%d", &N) != 1 || N < 3) return 1;
uma = malloc(sizeof(*uma) * N);
if (uma == NULL) return 2;
for (i = 0; i < N; i++) {
if (scanf("%d", &uma[i].T) != 1) return 1;
uma[i].id = i + 1;
}
qsort(uma, N, sizeof(*uma), cmp);
printf("%d %d %d\n", uma[0].id, uma[1].id, uma[2].id);
free(uma);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Trifecta |
| User | mikecat |
| Language | C23 (GCC 14.2.0) |
| Score | 200 |
| Code Size | 615 Byte |
| Status | AC |
| Exec Time | 0 ms |
| Memory | 1728 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| random_01.txt | AC | 0 ms | 1692 KiB |
| random_02.txt | AC | 0 ms | 1728 KiB |
| random_03.txt | AC | 0 ms | 1708 KiB |
| random_04.txt | AC | 0 ms | 1632 KiB |
| random_05.txt | AC | 0 ms | 1728 KiB |
| random_06.txt | AC | 0 ms | 1692 KiB |
| random_07.txt | AC | 0 ms | 1656 KiB |
| random_08.txt | AC | 0 ms | 1728 KiB |
| sample_01.txt | AC | 0 ms | 1712 KiB |
| sample_02.txt | AC | 0 ms | 1624 KiB |