161652025-04-08 12:42:08algoproTűzijátékpypy3Runtime error 36/5076ms32000 KiB
# UUID: dfb0917e-29f5-4cf7-81b8-b0b17027dede
def main():
    N, S, T = map(int, input().split())
    loc = list(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/043ms19368 KiB
2Runtime error0/074ms32000 KiB
3Accepted2/239ms19612 KiB
4Accepted2/239ms19380 KiB
5Accepted2/245ms19540 KiB
6Accepted2/245ms19564 KiB
7Accepted2/239ms19432 KiB
8Accepted2/241ms19548 KiB
9Accepted2/259ms21480 KiB
10Accepted2/259ms22248 KiB
11Accepted2/254ms22256 KiB
12Accepted2/261ms22772 KiB
13Accepted2/268ms22572 KiB
14Accepted2/268ms22664 KiB
15Accepted3/361ms22644 KiB
16Accepted3/361ms24508 KiB
17Accepted3/368ms26600 KiB
18Accepted3/376ms27604 KiB
19Runtime error0/365ms32000 KiB
20Runtime error0/374ms32000 KiB
21Runtime error0/475ms32000 KiB
22Runtime error0/464ms32000 KiB