95602024-02-23 08:58:17KezdőSzigetek (35 pont)python3Accepted 35/3598ms35124 KiB
from sys import stdin

def main():
    N = int(input())
    D = [int(i) for i in stdin.readline().split()]
    F = D[:]
    F[1] += F[0]
    for i in range(2,N):
        F[i] += min(F[i-1],F[i-2])
    print(F[-1])
   
main()
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/017ms11084 KiB
2Accepted0/094ms32012 KiB
3Accepted1/118ms11496 KiB
4Accepted1/117ms11864 KiB
5Accepted1/117ms12084 KiB
6Accepted1/117ms12240 KiB
7Accepted1/117ms12488 KiB
8Accepted2/217ms12480 KiB
9Accepted2/218ms12808 KiB
10Accepted2/219ms13404 KiB
11Accepted2/219ms13576 KiB
12Accepted2/220ms13956 KiB
13Accepted2/226ms14548 KiB
14Accepted2/232ms16344 KiB
15Accepted2/241ms18696 KiB
16Accepted2/257ms22756 KiB
17Accepted2/272ms27240 KiB
18Accepted2/282ms30232 KiB
19Accepted2/287ms31604 KiB
20Accepted2/293ms32616 KiB
21Accepted2/294ms34808 KiB
22Accepted2/298ms35124 KiB