123222024-12-12 11:47:40madvirSzigetek (35 pont)cpp11Accepted 35/3525ms1080 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++) {
        cin >> a[i];

    }
    a[1]+=a[0];
    for(int i=2; i<n; i++) {
        a[i]+=min(a[i-1],a[i-2]);
    }
    cout << a[n-1];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/01ms320 KiB
2Accepted0/025ms1080 KiB
3Accepted1/11ms512 KiB
4Accepted1/11ms500 KiB
5Accepted1/11ms320 KiB
6Accepted1/11ms320 KiB
7Accepted1/11ms320 KiB
8Accepted2/22ms320 KiB
9Accepted2/22ms320 KiB
10Accepted2/22ms320 KiB
11Accepted2/22ms320 KiB
12Accepted2/22ms320 KiB
13Accepted2/23ms320 KiB
14Accepted2/24ms516 KiB
15Accepted2/28ms580 KiB
16Accepted2/213ms780 KiB
17Accepted2/217ms904 KiB
18Accepted2/219ms992 KiB
19Accepted2/221ms1068 KiB
20Accepted2/221ms1064 KiB
21Accepted2/224ms1080 KiB
22Accepted2/225ms1064 KiB