15642022-11-25 12:03:07BenceJárda-L (40)cpp11Accepted 40/403ms4072 KiB
#include <iostream>
#include <vector>
using namespace std;
vector<long long> x,y;
int n,i,j;
long long s;
int main()
{
    cin>>n;
    x.resize(n+1);
    y.resize(n+1);
    x[1]=1;
    x[2]=2;
    y[2]=2;
    for(i=3; i<=n; ++i)
    {
        x[i]=x[i-1]+x[i-2]+y[i-1];
        y[i]=2*x[i-2]+y[i-1];
    }
    cout<<x[n];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1744 KiB
2Accepted0/02ms1996 KiB
3Accepted2/22ms2068 KiB
4Accepted2/22ms2080 KiB
5Accepted2/22ms2208 KiB
6Accepted2/22ms2416 KiB
7Accepted2/22ms2536 KiB
8Accepted3/32ms2592 KiB
9Accepted3/32ms2832 KiB
10Accepted3/32ms2924 KiB
11Accepted3/32ms3128 KiB
12Accepted3/32ms3240 KiB
13Accepted3/32ms3448 KiB
14Accepted3/32ms3680 KiB
15Accepted3/32ms3680 KiB
16Accepted3/32ms3872 KiB
17Accepted3/32ms4072 KiB