1887 | 2022-12-07 10:49:46 | peter | Rendőrségi Üldözés 4 | cpp17 | Wrong answer 0/100 | 2.598s | 4484 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1216 KiB | ||||
2 | Accepted | 2ms | 1376 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Time limit exceeded | 2.598s | 1604 KiB | ||||
4 | Time limit exceeded | 2.559s | 2016 KiB | ||||
5 | Time limit exceeded | 2.575s | 1732 KiB | ||||
6 | Time limit exceeded | 2.575s | 1996 KiB | ||||
7 | Time limit exceeded | 2.575s | 2092 KiB | ||||
subtask3 | 0/15 | ||||||
8 | Time limit exceeded | 2.559s | 1668 KiB | ||||
9 | Time limit exceeded | 2.568s | 2168 KiB | ||||
10 | Time limit exceeded | 2.563s | 2172 KiB | ||||
11 | Time limit exceeded | 2.562s | 2704 KiB | ||||
subtask4 | 0/15 | ||||||
12 | Wrong answer | 2ms | 2824 KiB | ||||
13 | Wrong answer | 2ms | 2792 KiB | ||||
14 | Wrong answer | 2ms | 2736 KiB | ||||
15 | Wrong answer | 2ms | 3092 KiB | ||||
subtask5 | 0/25 | ||||||
16 | Wrong answer | 2ms | 3116 KiB | ||||
17 | Wrong answer | 2ms | 3056 KiB | ||||
18 | Wrong answer | 2ms | 3056 KiB | ||||
19 | Wrong answer | 2ms | 3292 KiB | ||||
20 | Wrong answer | 2ms | 3368 KiB | ||||
subtask6 | 0/15 | ||||||
21 | Time limit exceeded | 2.543s | 3564 KiB | ||||
22 | Time limit exceeded | 2.575s | 3608 KiB | ||||
23 | Time limit exceeded | 2.552s | 3900 KiB | ||||
24 | Time limit exceeded | 2.563s | 3476 KiB | ||||
25 | Time limit exceeded | 2.563s | 3820 KiB | ||||
subtask7 | 0/20 | ||||||
26 | Time limit exceeded | 2.563s | 4384 KiB | ||||
27 | Time limit exceeded | 2.568s | 4368 KiB | ||||
28 | Time limit exceeded | 2.543s | 4484 KiB | ||||
29 | Time limit exceeded | 2.559s | 4364 KiB | ||||
30 | Time limit exceeded | 2.563s | 4352 KiB |