88252024-01-31 17:23:44NagyLeoSzigetek (35 pont)pypy3Runtime error 21/3568ms100668 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
base21/35
1Accepted0/043ms76540 KiB
2Runtime error0/063ms99720 KiB
3Accepted1/141ms76904 KiB
4Accepted1/139ms77324 KiB
5Accepted1/146ms77344 KiB
6Accepted1/143ms78016 KiB
7Accepted1/146ms77520 KiB
8Accepted2/245ms78996 KiB
9Accepted2/257ms88636 KiB
10Accepted2/257ms88672 KiB
11Accepted2/257ms89068 KiB
12Accepted2/257ms89500 KiB
13Accepted2/261ms89548 KiB
14Accepted2/257ms93856 KiB
15Accepted2/264ms97340 KiB
16Runtime error0/264ms100648 KiB
17Runtime error0/268ms100668 KiB
18Runtime error0/268ms98064 KiB
19Runtime error0/261ms95116 KiB
20Runtime error0/265ms94736 KiB
21Runtime error0/259ms94976 KiB
22Runtime error0/264ms94740 KiB