18612022-12-05 19:33:59peterLudak Harcacpp17Accepted 100/10014ms4196 KiB
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n;
	scanf("%d", &n);
	int* j = (int*)malloc(sizeof(int) * n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &j[i]);
	}
	
	int dobasok[] = { 0, 0, 0, 0, 0, 0 };
	int dobas[] = { 1, 2 ,3 ,4 ,5 ,6 };
	int jelenlegi;
	for (int i = 0; i < 6; i++)
	{
		jelenlegi = 0;
		while (jelenlegi < n)
		{
			jelenlegi += dobas[i];
			while (jelenlegi < n && j[jelenlegi] != 0)
			{
				jelenlegi += j[jelenlegi];
			}
			dobasok[i]++;
		}
	}
	
	for (int i = 0; i < 6; i++)
	{
		printf("%d ", dobasok[i]);
	}
	

	free(j);

	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1360 KiB
2Accepted2ms1840 KiB
subtask225/25
3Accepted2ms1948 KiB
4Accepted2ms2092 KiB
5Accepted2ms2132 KiB
6Accepted3ms2108 KiB
7Accepted12ms2960 KiB
subtask340/40
8Accepted2ms2676 KiB
9Accepted2ms2784 KiB
10Accepted3ms2796 KiB
11Accepted4ms2840 KiB
12Accepted7ms3008 KiB
13Accepted9ms3332 KiB
14Accepted13ms3576 KiB
15Accepted14ms3840 KiB
subtask435/35
16Accepted3ms3572 KiB
17Accepted4ms3660 KiB
18Accepted4ms3660 KiB
19Accepted7ms3732 KiB
20Accepted8ms4056 KiB
21Accepted8ms4080 KiB
22Accepted9ms4052 KiB
23Accepted12ms4048 KiB
24Accepted13ms4052 KiB
25Accepted14ms4196 KiB