161672025-04-08 12:48:42algoproTűzijátékpypy3Runtime error 36/5075ms32000 KiB
# UUID: 85d1c24f-d60f-43ba-be18-eb9bde1ba9d5
from sys import stdin
input = stdin.readline
def main():
    N, S, T = map(int, input().split())
    loc = tuple(map(int, input().split()))

    target = S - 1

    ans = [target + 1]
    last = loc[target]
    for i in range(target + 1, N):

        if last + T <= loc[i]:
            # if i+1 == target and loc[i]+T > loc[i+1]:
            #    continue
            ans.append(i + 1)
            last = loc[i]

    # ans2=[]
    last = loc[target]
    for i in range(target - 1, -1, -1):
        if last - T >= loc[i]:
            ans.append(i + 1)
            last = loc[i]

    print(len(ans))
    print(*sorted(ans))

main()
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/043ms19364 KiB
2Runtime error0/068ms32000 KiB
3Accepted2/243ms19372 KiB
4Accepted2/239ms19540 KiB
5Accepted2/246ms19432 KiB
6Accepted2/239ms19440 KiB
7Accepted2/239ms19380 KiB
8Accepted2/246ms19692 KiB
9Accepted2/257ms21608 KiB
10Accepted2/261ms22216 KiB
11Accepted2/256ms22240 KiB
12Accepted2/263ms22812 KiB
13Accepted2/261ms22972 KiB
14Accepted2/261ms22680 KiB
15Accepted3/368ms22992 KiB
16Accepted3/371ms25316 KiB
17Accepted3/368ms27092 KiB
18Accepted3/370ms28056 KiB
19Runtime error0/375ms32000 KiB
20Runtime error0/375ms32000 KiB
21Runtime error0/465ms32000 KiB
22Runtime error0/472ms32000 KiB