212202026-01-12 17:10:05algoproSzigetek (35 pont)pypy3Runtime error 27/3575ms32000 KiB
# UUID: 996f9948-049f-49cc-af59-2cb3fb6549df
N = int(input())
cost = list(map(int, input().split()))

# 1-indexeléshez
cost = [0] + cost

DP = [0] * (N + 1)

DP[1] = cost[1]
DP[2] = cost[1] + cost[2]

for i in range(3, N + 1):
    DP[i] = min(DP[i - 1], DP[i - 2]) + cost[i]

print(DP[N])
SubtaskSumTestVerdictTimeMemory
base27/35
1Accepted0/043ms19504 KiB
2Runtime error0/067ms32000 KiB
3Accepted1/141ms19436 KiB
4Accepted1/143ms19492 KiB
5Accepted1/146ms19340 KiB
6Accepted1/146ms19524 KiB
7Accepted1/146ms19532 KiB
8Accepted2/243ms21156 KiB
9Accepted2/257ms21500 KiB
10Accepted2/257ms21892 KiB
11Accepted2/257ms21632 KiB
12Accepted2/248ms21736 KiB
13Accepted2/256ms21728 KiB
14Accepted2/252ms23676 KiB
15Accepted2/252ms24888 KiB
16Accepted2/265ms27368 KiB
17Accepted2/274ms30256 KiB
18Accepted2/275ms31548 KiB
19Runtime error0/274ms32000 KiB
20Runtime error0/264ms32000 KiB
21Runtime error0/275ms32000 KiB
22Runtime error0/275ms32000 KiB