Submission #73300443


Source Code Expand

n = int(input())
a = list(map(int, input().split()))

ans = [0] * n

for i in range(n-1, -1, -1):
    if a[i] == i+1:
        ans[i] = i+1
    else:
        ans[i] = ans[a[i] - 1]

print(*ans)

Submission Info

Submission Time
Task C - Sugoroku Destination
User gett
Language Python (PyPy 3.11-v7.3.20)
Score 300
Code Size 207 Byte
Status AC
Exec Time 380 ms
Memory 198428 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 18
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 49 ms 79592 KiB
00_sample_01.txt AC 49 ms 79356 KiB
00_sample_02.txt AC 48 ms 79720 KiB
01_random_03.txt AC 371 ms 193760 KiB
01_random_04.txt AC 374 ms 196056 KiB
01_random_05.txt AC 373 ms 195580 KiB
01_random_06.txt AC 380 ms 196016 KiB
01_random_07.txt AC 370 ms 196644 KiB
01_random_08.txt AC 370 ms 197136 KiB
01_random_09.txt AC 365 ms 198300 KiB
01_random_10.txt AC 365 ms 197380 KiB
01_random_11.txt AC 173 ms 141304 KiB
01_random_12.txt AC 157 ms 136800 KiB
01_random_13.txt AC 331 ms 178836 KiB
01_random_14.txt AC 82 ms 112008 KiB
01_random_15.txt AC 362 ms 198428 KiB
01_random_16.txt AC 49 ms 79356 KiB
01_random_17.txt AC 357 ms 192552 KiB