18602022-12-05 19:20:26peterLudak Harcacpp17Runtime error 0/10014ms4472 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);
	free(dobasok);
	free(dobas);

	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Runtime error3ms1556 KiB
2Runtime error2ms1692 KiB
subtask20/25
3Runtime error2ms1884 KiB
4Runtime error2ms2104 KiB
5Runtime error2ms2368 KiB
6Runtime error3ms2448 KiB
7Runtime error12ms2968 KiB
subtask30/40
8Runtime error2ms2920 KiB
9Runtime error3ms3124 KiB
10Runtime error3ms3324 KiB
11Runtime error4ms3428 KiB
12Runtime error7ms3452 KiB
13Runtime error9ms3644 KiB
14Runtime error13ms3712 KiB
15Runtime error14ms4028 KiB
subtask40/35
16Runtime error4ms3988 KiB
17Runtime error4ms4108 KiB
18Runtime error6ms4144 KiB
19Runtime error7ms4120 KiB
20Runtime error8ms4212 KiB
21Runtime error8ms4280 KiB
22Runtime error10ms4332 KiB
23Runtime error12ms4332 KiB
24Runtime error13ms4336 KiB
25Runtime error14ms4472 KiB