96942024-02-27 21:04:31birozsSzigetek (35 pont)python3Accepted 35/35101ms34688 KiB
#be = open("in.18")
n = int(input())
lista = list(map(int,input().split()))
sor = [lista[0],lista[0]+lista[1]]
for i in range(2,n):
    if sor[i-2] <= sor[i-1]:
        sor.append(sor[i-2]+lista[i])
    else:
        sor.append(sor[i-1]+lista[i])
print(sor[-1])

    
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/017ms11068 KiB
2Accepted0/0101ms32328 KiB
3Accepted1/117ms11904 KiB
4Accepted1/117ms11944 KiB
5Accepted1/117ms12036 KiB
6Accepted1/117ms12244 KiB
7Accepted1/117ms12084 KiB
8Accepted2/218ms12312 KiB
9Accepted2/218ms12532 KiB
10Accepted2/220ms13048 KiB
11Accepted2/220ms13644 KiB
12Accepted2/220ms13828 KiB
13Accepted2/226ms14820 KiB
14Accepted2/235ms16488 KiB
15Accepted2/243ms18492 KiB
16Accepted2/261ms23100 KiB
17Accepted2/278ms28420 KiB
18Accepted2/282ms29724 KiB
19Accepted2/289ms31748 KiB
20Accepted2/297ms33260 KiB
21Accepted2/2100ms34256 KiB
22Accepted2/2101ms34688 KiB