71652024-01-01 10:16:52MagyarKendeSZLGSzigetek (35 pont)cpp17Accepted 35/3513ms4248 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define has(s, e) s.count(e)

using namespace std;
using ll = long long;
using point = array<int, 2>;

int main() {
    speed;

    int N;
    cin >> N;
    vector<int> v(N);
    cinv(v);

    v[1] += v[0];

    for (int i = 2; i < N; i++) {
        v[i] = min(v[i - 1], v[i - 2]) + v[i];
    }

    cout << v[N - 1];
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/03ms1824 KiB
2Accepted0/013ms2840 KiB
3Accepted1/13ms2504 KiB
4Accepted1/13ms2408 KiB
5Accepted1/13ms2528 KiB
6Accepted1/13ms2744 KiB
7Accepted1/13ms2912 KiB
8Accepted2/23ms3008 KiB
9Accepted2/23ms3012 KiB
10Accepted2/23ms3016 KiB
11Accepted2/23ms3020 KiB
12Accepted2/23ms3276 KiB
13Accepted2/23ms3252 KiB
14Accepted2/24ms3288 KiB
15Accepted2/26ms3464 KiB
16Accepted2/28ms3380 KiB
17Accepted2/29ms3784 KiB
18Accepted2/210ms3772 KiB
19Accepted2/210ms4104 KiB
20Accepted2/212ms4104 KiB
21Accepted2/213ms4100 KiB
22Accepted2/213ms4248 KiB