71572024-01-01 09:18:24MagyarKendeSZLGJárda-L (40)cpp17Accepted 40/403ms3956 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)

using namespace std;
using ll = long long;

int main() {
    speed;

    int N;
    cin >> N;
    vector<ll> dp(N + 1);

    dp[0] = 1;

    for (int i = 1; i <= N; i++) {

        dp[i] += dp[i - 1];
        
        if (i > 1) dp[i] += dp[i - 2];

        for (int j = 3; j <= i; j += 2) {
            dp[i] += dp[i - j] * 2;
        }

        for (int j = 4; j <= i; j += 2) {
            dp[i] += dp[i - j] * 2;
        }
    }

    cout << dp[N];
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1824 KiB
2Accepted0/03ms2060 KiB
3Accepted2/23ms2272 KiB
4Accepted2/23ms2440 KiB
5Accepted2/23ms2676 KiB
6Accepted2/23ms2888 KiB
7Accepted2/23ms3096 KiB
8Accepted3/33ms3308 KiB
9Accepted3/32ms3396 KiB
10Accepted3/33ms3520 KiB
11Accepted3/33ms3608 KiB
12Accepted3/33ms3588 KiB
13Accepted3/33ms3588 KiB
14Accepted3/32ms3592 KiB
15Accepted3/33ms3720 KiB
16Accepted3/33ms3800 KiB
17Accepted3/33ms3956 KiB