72282024-01-03 21:24:23Laci3000Járda-L (40)cpp17Accepted 40/403ms3256 KiB
// nemes tihamer 2020 masodik.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>


using namespace std;


void i_es_l_jardak() {
    int hossz; cin >> hossz;
    vector<long long>dpSi(hossz), dpSl(hossz);

    if (hossz < 2) {
        cout << 1;
        return;
    }
    dpSi[0] = 1;
    dpSi[1] = 2;
    dpSl[1] = 2;


    for (int i = 2; i < hossz; i++) {
        dpSl[i] = dpSl[i - 1] + dpSi[i - 2] * 2;
        dpSi[i] = dpSi[i - 1] + dpSi[i - 2] + dpSl[i - 1];
    }
    cout << dpSi[hossz - 1];

}


int main()
{
    cin.sync_with_stdio(false);
    cin.tie(nullptr);
    i_es_l_jardak();
}

SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1828 KiB
2Accepted0/03ms2028 KiB
3Accepted2/23ms2240 KiB
4Accepted2/22ms2328 KiB
5Accepted2/23ms2336 KiB
6Accepted2/23ms2460 KiB
7Accepted2/23ms2672 KiB
8Accepted3/33ms2648 KiB
9Accepted3/33ms2788 KiB
10Accepted3/33ms2872 KiB
11Accepted3/33ms3008 KiB
12Accepted3/33ms3096 KiB
13Accepted3/33ms3096 KiB
14Accepted3/33ms3104 KiB
15Accepted3/33ms3112 KiB
16Accepted3/33ms3256 KiB
17Accepted3/33ms3188 KiB