57352023-09-10 19:53:09kukkermanSzigetek (35 pont)cpp14Accepted 35/3526ms5696 KiB
#include <iostream>
#include <vector>

std::vector<size_t> beolvas(std::istream &in) {
    size_t n;
    in >> n;

    std::vector<size_t> v(n);
    for (auto i = 0u; i < n; i++) {
        in >> v[i];
    }

    return v;
}

void feldolgoz(const std::vector<size_t> &v) {
    const auto n = v.size();

    size_t a = v[0];
    size_t b = a + v[1];
    for (auto i = 2; i < n; i++) {
        const auto c = v[i] + std::min(a, b);
        a = b;
        b = c;
    }

    std::cout << b << std::endl;
}

int main() {
    const auto v = beolvas(std::cin);
    feldolgoz(v);

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/03ms1808 KiB
2Accepted0/026ms3360 KiB
3Accepted1/13ms2224 KiB
4Accepted1/13ms2432 KiB
5Accepted1/12ms2656 KiB
6Accepted1/13ms2852 KiB
7Accepted1/13ms3068 KiB
8Accepted2/23ms3284 KiB
9Accepted2/23ms3524 KiB
10Accepted2/23ms3752 KiB
11Accepted2/23ms3840 KiB
12Accepted2/24ms3852 KiB
13Accepted2/24ms3880 KiB
14Accepted2/27ms4012 KiB
15Accepted2/29ms4272 KiB
16Accepted2/214ms4860 KiB
17Accepted2/218ms5084 KiB
18Accepted2/220ms5476 KiB
19Accepted2/223ms5600 KiB
20Accepted2/224ms5600 KiB
21Accepted2/226ms5696 KiB
22Accepted2/226ms5580 KiB