112952024-08-04 16:32:01probaTűzijátékpython3Accepted 50/5082ms15012 KiB
#fire
#sor1 = '6 4 100'; sor2 = '0 70 110 210 230 500'
sor1 = input(); sor2 = input()

L1 = list(map(int, sor1.split(' '))); N, telep, tav = L1[0], L1[1], L1[2]; helyek = list(map(int, sor2.split(' ')))

ok = [telep]
utolso = telep-1
for i in range(telep-2, -1, -1):
    if helyek[utolso]-helyek[i] >= tav:
        ok += [i+1]; utolso = i

utolso = telep-1

for i in range(telep, N):
    if helyek[i]-helyek[utolso] >= tav:
        ok += [i+1]; utolso = i

ok.sort()
print(len(ok))
print(*ok)
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms3044 KiB
2Accepted0/075ms14760 KiB
3Accepted2/217ms2960 KiB
4Accepted2/218ms3044 KiB
5Accepted2/217ms3048 KiB
6Accepted2/217ms2904 KiB
7Accepted2/217ms3044 KiB
8Accepted2/217ms3064 KiB
9Accepted2/221ms3684 KiB
10Accepted2/223ms4068 KiB
11Accepted2/223ms4020 KiB
12Accepted2/228ms5148 KiB
13Accepted2/229ms5132 KiB
14Accepted2/228ms5092 KiB
15Accepted3/328ms5356 KiB
16Accepted3/335ms6608 KiB
17Accepted3/341ms7872 KiB
18Accepted3/346ms9048 KiB
19Accepted3/382ms14792 KiB
20Accepted3/376ms14752 KiB
21Accepted4/481ms14708 KiB
22Accepted4/475ms15012 KiB