Submission #66987982
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>/* 降順 */int cmp(const void* x, const void* y) {int a = *(const int*)x, b = *(const int*)y;return a > b ? -1 : a < b;}int main(void) {int N, *A;int i;if (scanf("%d", &N) != 1) return 1;A = malloc(sizeof(*A) * N);if (A == NULL) return 2;for (i = 0; i < N; i++) {if (scanf("%d", &A[i]) != 1) {free(A);return 1;}}
#include <stdio.h> #include <stdlib.h> /* 降順 */ int cmp(const void* x, const void* y) { int a = *(const int*)x, b = *(const int*)y; return a > b ? -1 : a < b; } int main(void) { int N, *A; int i; if (scanf("%d", &N) != 1) return 1; A = malloc(sizeof(*A) * N); if (A == NULL) return 2; for (i = 0; i < N; i++) { if (scanf("%d", &A[i]) != 1) { free(A); return 1; } } qsort(A, N, sizeof(*A), cmp); for (i = N; i > 0; i--) { if (A[i - 1] >= i) { printf("%d\n", i); free(A); return 0; } } puts("0"); free(A); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Citation |
User | mikecat |
Language | C (gcc 12.2.0) |
Score | 200 |
Code Size | 593 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 1724 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 1568 KiB |
00_sample_02.txt | AC | 1 ms | 1572 KiB |
01_test_01.txt | AC | 1 ms | 1628 KiB |
01_test_02.txt | AC | 1 ms | 1620 KiB |
01_test_03.txt | AC | 1 ms | 1720 KiB |
01_test_04.txt | AC | 1 ms | 1564 KiB |
01_test_05.txt | AC | 1 ms | 1612 KiB |
01_test_06.txt | AC | 1 ms | 1700 KiB |
01_test_07.txt | AC | 1 ms | 1708 KiB |
01_test_08.txt | AC | 1 ms | 1596 KiB |
01_test_09.txt | AC | 1 ms | 1720 KiB |
01_test_10.txt | AC | 1 ms | 1636 KiB |
01_test_11.txt | AC | 1 ms | 1624 KiB |
01_test_12.txt | AC | 1 ms | 1624 KiB |
01_test_13.txt | AC | 1 ms | 1624 KiB |
01_test_14.txt | AC | 1 ms | 1708 KiB |
01_test_15.txt | AC | 1 ms | 1724 KiB |
01_test_16.txt | AC | 1 ms | 1724 KiB |
01_test_17.txt | AC | 1 ms | 1724 KiB |
01_test_18.txt | AC | 1 ms | 1724 KiB |
01_test_19.txt | AC | 1 ms | 1620 KiB |
01_test_20.txt | AC | 1 ms | 1724 KiB |
01_test_21.txt | AC | 0 ms | 1592 KiB |
01_test_22.txt | AC | 0 ms | 1640 KiB |
01_test_23.txt | AC | 1 ms | 1624 KiB |
01_test_24.txt | AC | 1 ms | 1636 KiB |
01_test_25.txt | AC | 1 ms | 1620 KiB |
01_test_26.txt | AC | 0 ms | 1568 KiB |
01_test_27.txt | AC | 1 ms | 1720 KiB |
01_test_28.txt | AC | 1 ms | 1628 KiB |