88262024-01-31 17:24:14NagyLeoSzigetek (35 pont)python3Accepted 35/3592ms37148 KiB
def min_cost():
    N = int(input())
    fees = list(map(int, input().split()))
    min_fees = [0] * N

    min_fees[0] = fees[0]
    min_fees[1] = fees[0] + fees[1]
    for i in range(2, N):
        min_fees[i] = min(min_fees[i - 1], min_fees[i - 2]) + fees[i]

    return min_fees[N - 1]


print(min_cost())

SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/017ms10960 KiB
2Accepted0/092ms32576 KiB
3Accepted1/118ms11924 KiB
4Accepted1/117ms12136 KiB
5Accepted1/117ms12396 KiB
6Accepted1/117ms12264 KiB
7Accepted1/117ms12528 KiB
8Accepted2/218ms12800 KiB
9Accepted2/218ms13028 KiB
10Accepted2/219ms13020 KiB
11Accepted2/220ms13452 KiB
12Accepted2/220ms14260 KiB
13Accepted2/225ms14820 KiB
14Accepted2/232ms16512 KiB
15Accepted2/239ms18480 KiB
16Accepted2/254ms22972 KiB
17Accepted2/268ms28836 KiB
18Accepted2/274ms30800 KiB
19Accepted2/279ms33180 KiB
20Accepted2/281ms35044 KiB
21Accepted2/287ms36244 KiB
22Accepted2/290ms37148 KiB