239412026-02-01 16:47:12zsombTűzijátékpython3Runtime error 46/5074ms14012 KiB

(n,p,k) = map(int, input().split())


vec = list(map(int, input().split()))

anws = []
lastStop = vec[p-1]

for i in range(p, -1, -1):
    if lastStop-vec[i] >= k:
        anws.append(i)
        lastStop = vec[i]

anws.reverse()
anws.append(p-1)
lastStop = vec[p-1]

for i in range(p, n):
    if vec[i]-lastStop >= k:
        anws.append(i)
        lastStop = vec[i]


print(len(anws))
for i in anws:
    print(i+1, " ", sep = "", end="")
SubtaskSumTestVerdictTimeMemory
base46/50
1Accepted0/016ms3060 KiB
2Accepted0/074ms13916 KiB
3Accepted2/214ms3124 KiB
4Runtime error0/216ms3124 KiB
5Accepted2/216ms2992 KiB
6Runtime error0/216ms3108 KiB
7Accepted2/214ms3124 KiB
8Accepted2/217ms3144 KiB
9Accepted2/219ms3604 KiB
10Accepted2/221ms3992 KiB
11Accepted2/220ms4148 KiB
12Accepted2/228ms5220 KiB
13Accepted2/227ms5132 KiB
14Accepted2/225ms5116 KiB
15Accepted3/325ms5244 KiB
16Accepted3/332ms6476 KiB
17Accepted3/337ms7604 KiB
18Accepted3/343ms8920 KiB
19Accepted3/371ms13924 KiB
20Accepted3/374ms13880 KiB
21Accepted4/472ms14012 KiB
22Accepted4/459ms13996 KiB