Submission #73851068
Source Code Expand
Copy
#include <stdio.h>int N;int A[512345];int main(void) {int i;int max = 2;if (scanf("%d", &N) != 1) return 1;for (i = 1; i <= N; i++) {if (scanf("%d", &A[i]) != 1) return 1;}for (i = 1; i <= N && i < max; i++) {if (i + A[i] > max) max = i + A[i];}printf("%d\n", max > N ? N : max - 1);return 0;}
#include <stdio.h>
int N;
int A[512345];
int main(void) {
int i;
int max = 2;
if (scanf("%d", &N) != 1) return 1;
for (i = 1; i <= N; i++) {
if (scanf("%d", &A[i]) != 1) return 1;
}
for (i = 1; i <= N && i < max; i++) {
if (i + A[i] > max) max = i + A[i];
}
printf("%d\n", max > N ? N : max - 1);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Domino |
| User | mikecat |
| Language | C23 (GCC 14.2.0) |
| Score | 300 |
| Code Size | 342 Byte |
| Status | AC |
| Exec Time | 27 ms |
| Memory | 3872 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| min.txt | AC | 0 ms | 1752 KiB |
| random_01.txt | AC | 27 ms | 3620 KiB |
| random_02.txt | AC | 11 ms | 2416 KiB |
| random_03.txt | AC | 27 ms | 3752 KiB |
| random_04.txt | AC | 5 ms | 2036 KiB |
| random_05.txt | AC | 27 ms | 3784 KiB |
| random_06.txt | AC | 26 ms | 3688 KiB |
| random_07.txt | AC | 26 ms | 3764 KiB |
| random_08.txt | AC | 15 ms | 2896 KiB |
| random_09.txt | AC | 26 ms | 3872 KiB |
| random_10.txt | AC | 22 ms | 3216 KiB |
| random_11.txt | AC | 27 ms | 3704 KiB |
| random_12.txt | AC | 8 ms | 2408 KiB |
| random_13.txt | AC | 20 ms | 3764 KiB |
| random_14.txt | AC | 26 ms | 3728 KiB |
| random_15.txt | AC | 26 ms | 3756 KiB |
| random_16.txt | AC | 26 ms | 3736 KiB |
| sample_01.txt | AC | 0 ms | 1752 KiB |
| sample_02.txt | AC | 0 ms | 1648 KiB |
| sample_03.txt | AC | 1 ms | 1680 KiB |