29052023-02-02 13:21:08UnluckYToronyépítés (1,1,3,3)cpp11Accepted 50/5018ms16364 KiB
#include <bits/stdc++.h>

using namespace std;

const int MOD = 20210108;

int main(){


    int n; cin >> n;
    vector<int> dp = {1, 2, 4};

    for (int i = 3; i <= n; i++){
        dp.push_back((2*dp[i-1] + 2*dp[i-3]) % MOD);
    }

    cout << dp[n];

    // dp(n) = 2*dp(n-1) + 2*dp(n-3)

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1960 KiB
2Accepted0/03ms2136 KiB
3Accepted3/33ms2332 KiB
4Accepted3/32ms2400 KiB
5Accepted4/42ms2612 KiB
6Accepted4/43ms2708 KiB
7Accepted4/418ms15336 KiB
8Accepted4/44ms5032 KiB
9Accepted4/43ms3356 KiB
10Accepted4/43ms3520 KiB
11Accepted4/46ms6852 KiB
12Accepted4/417ms16096 KiB
13Accepted4/417ms16364 KiB
14Accepted4/47ms7176 KiB
15Accepted2/23ms4104 KiB
16Accepted2/22ms4176 KiB