7092021-11-18 20:13:19Valaki2Toronyépítés (1,1,3,3)cpp14Accepted 50/5016ms9764 KiB
#include <bits/stdc++.h>
using namespace std;

const int mod = 20210108;

void solve() {
    int n;
    cin >> n;
    vector<int> dp(1 + n, 0);
    dp[0] = int(1ll);
    for(int i = 1; i <= n; i++) {
        dp[i] += 2 * dp[i - 1];
        if(i >= 3) {
            dp[i] += 2 * dp[i - 3];
        }
        dp[i] %= mod;
    }
    cout << dp[n] << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms2008 KiB
2Accepted0/02ms2080 KiB
3Accepted3/32ms2120 KiB
4Accepted3/32ms2128 KiB
5Accepted4/41ms2132 KiB
6Accepted4/42ms2136 KiB
7Accepted4/410ms9744 KiB
8Accepted4/42ms2988 KiB
9Accepted4/41ms2152 KiB
10Accepted4/42ms2152 KiB
11Accepted4/44ms3516 KiB
12Accepted4/49ms9764 KiB
13Accepted4/48ms8856 KiB
14Accepted4/416ms4568 KiB
15Accepted2/21ms2172 KiB
16Accepted2/21ms2172 KiB