18872022-12-07 10:49:46peterRendőrségi Üldözés 4cpp17Wrong answer 0/1002.598s4484 KiB
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

bool zolde(int ido, int periodus)
{
	return ido % (2 * periodus) < periodus;	
}

bool lampae(int koordinata, int* lampak, int lampakszama)
{
	for (int i = 0; i < lampakszama; i++)
	{
		if (lampak[i] == koordinata)
		{
			return true;
		}
	}
	return false;
}

int main()
{
	int lampakszama, athaladhat, periodusfele, utcahossz;
	scanf("%d %d %d %d", &lampakszama, &athaladhat, &periodusfele, &utcahossz);

	int* koordinatak = (int*)malloc(sizeof(int) * lampakszama);
	for (int i = 0; i < lampakszama; i++)
	{
		scanf("%d", &koordinatak[i]);
	}

	int ido = 0;
	int koordinata = 0;

	do
	{
		
		if (lampae(koordinata, koordinatak, lampakszama))
		{
			if (zolde(ido, periodusfele))
			{
				koordinata++;
			}
			else
			{
				if (athaladhat == 0)
				{
					; // üres --> várakozik a lámpánál
				}
				else
				{
					
				}
			}
		}
		else
		{
			koordinata++;
		}
		ido++;

	} while (koordinata < utcahossz);

	printf("%d", ido);

	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1216 KiB
2Accepted2ms1376 KiB
subtask20/10
3Time limit exceeded2.598s1604 KiB
4Time limit exceeded2.559s2016 KiB
5Time limit exceeded2.575s1732 KiB
6Time limit exceeded2.575s1996 KiB
7Time limit exceeded2.575s2092 KiB
subtask30/15
8Time limit exceeded2.559s1668 KiB
9Time limit exceeded2.568s2168 KiB
10Time limit exceeded2.563s2172 KiB
11Time limit exceeded2.562s2704 KiB
subtask40/15
12Wrong answer2ms2824 KiB
13Wrong answer2ms2792 KiB
14Wrong answer2ms2736 KiB
15Wrong answer2ms3092 KiB
subtask50/25
16Wrong answer2ms3116 KiB
17Wrong answer2ms3056 KiB
18Wrong answer2ms3056 KiB
19Wrong answer2ms3292 KiB
20Wrong answer2ms3368 KiB
subtask60/15
21Time limit exceeded2.543s3564 KiB
22Time limit exceeded2.575s3608 KiB
23Time limit exceeded2.552s3900 KiB
24Time limit exceeded2.563s3476 KiB
25Time limit exceeded2.563s3820 KiB
subtask70/20
26Time limit exceeded2.563s4384 KiB
27Time limit exceeded2.568s4368 KiB
28Time limit exceeded2.543s4484 KiB
29Time limit exceeded2.559s4364 KiB
30Time limit exceeded2.563s4352 KiB