88242024-01-31 17:11:08NagyLeoSzigetek (35 pont)pypy3Runtime error 1/35158ms102768 KiB
N = int(input())
fees = [0, 0]+list(map(int, input().split()))
N+=2
min_fee = fees[N-1]


def min_cost(current_id):
    global min_fee, fees
    if current_id < 2:
        return
    min_fee += min(fees[current_id-1], fees[current_id-2])
    if fees[current_id-1] > fees[current_id-2]:
        min_cost(current_id-2)
    else:
        min_cost(current_id-1)


min_cost(N-1)
print(min_fee)

SubtaskSumTestVerdictTimeMemory
base1/35
1Accepted0/048ms76392 KiB
2Runtime error0/064ms99868 KiB
3Wrong answer0/139ms76632 KiB
4Wrong answer0/139ms77048 KiB
5Wrong answer0/146ms77380 KiB
6Accepted1/148ms77412 KiB
7Wrong answer0/148ms77748 KiB
8Wrong answer0/252ms79944 KiB
9Wrong answer0/257ms89740 KiB
10Internal error0/2145ms100412 KiB
11Internal error0/2150ms101516 KiB
12Internal error0/2140ms100392 KiB
13Internal error0/2140ms100168 KiB
14Internal error0/2158ms101244 KiB
15Internal error0/2143ms102768 KiB
16Runtime error0/264ms101376 KiB
17Runtime error0/270ms101212 KiB
18Runtime error0/259ms98688 KiB
19Runtime error0/268ms97280 KiB
20Runtime error0/261ms97796 KiB
21Runtime error0/264ms95804 KiB
22Runtime error0/265ms95560 KiB