1890 | 2022-12-07 11:05:47 | peter | Rendőrségi Üldözés 4 | cpp17 | Wrong answer 0/100 | 2.599s | 3844 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;
int meglampa = lampakszama;
do
{
if (lampae(koordinata, koordinatak, lampakszama))
{
if (zolde(ido, periodusfele))
{
koordinata++;
}
else
{
if (athaladhat >= meglampa)
{
athaladhat--;
koordinata++;
}
else
{
}
}
meglampa--;
}
else
{
koordinata++;
}
ido++;
} while (koordinata < utcahossz);
printf("%d", ido);
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1364 KiB | ||||
2 | Wrong answer | 2ms | 1624 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Time limit exceeded | 2.598s | 1836 KiB | ||||
4 | Time limit exceeded | 2.563s | 2000 KiB | ||||
5 | Time limit exceeded | 2.559s | 2104 KiB | ||||
6 | Time limit exceeded | 2.579s | 2240 KiB | ||||
7 | Time limit exceeded | 2.548s | 2512 KiB | ||||
subtask3 | 0/15 | ||||||
8 | Time limit exceeded | 2.575s | 2996 KiB | ||||
9 | Time limit exceeded | 2.566s | 2532 KiB | ||||
10 | Time limit exceeded | 2.578s | 2876 KiB | ||||
11 | Time limit exceeded | 2.552s | 3156 KiB | ||||
subtask4 | 0/15 | ||||||
12 | Wrong answer | 2ms | 2940 KiB | ||||
13 | Wrong answer | 2ms | 3040 KiB | ||||
14 | Wrong answer | 2ms | 3148 KiB | ||||
15 | Wrong answer | 2ms | 3000 KiB | ||||
subtask5 | 0/25 | ||||||
16 | Wrong answer | 2ms | 3068 KiB | ||||
17 | Wrong answer | 2ms | 3308 KiB | ||||
18 | Wrong answer | 2ms | 3392 KiB | ||||
19 | Wrong answer | 2ms | 3472 KiB | ||||
20 | Wrong answer | 2ms | 3544 KiB | ||||
subtask6 | 0/15 | ||||||
21 | Time limit exceeded | 2.599s | 3480 KiB | ||||
22 | Time limit exceeded | 2.539s | 3704 KiB | ||||
23 | Time limit exceeded | 2.563s | 3680 KiB | ||||
24 | Time limit exceeded | 2.562s | 3344 KiB | ||||
25 | Time limit exceeded | 2.572s | 3632 KiB | ||||
subtask7 | 0/20 | ||||||
26 | Time limit exceeded | 2.575s | 3532 KiB | ||||
27 | Time limit exceeded | 2.572s | 3844 KiB | ||||
28 | Time limit exceeded | 2.575s | 3672 KiB | ||||
29 | Time limit exceeded | 2.559s | 3840 KiB | ||||
30 | Time limit exceeded | 2.572s | 3844 KiB |