3722021-11-03 08:01:37kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Runtime error 38/5032ms61692 KiB
#include <iostream>
#include <vector>

using namespace std;

vector<int> variationS;

int variations(int n) {
    if (n < 0) {
        return 0;
    }
    if (n == 0) {
        return 1;
    }
    if (variationS[n]) {
        return variationS[n];
    }
    variationS[n] = (2 * variations(n - 1) + 2 * variations(n - 3)) % 20210108;
    return variationS[n];
}

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

    int N;
    cin >> N;
    variationS.resize(N + 1);
    cout << variations(N) << '\n';
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/01ms1816 KiB
2Accepted0/01ms2052 KiB
3Accepted3/31ms1924 KiB
4Accepted3/31ms1932 KiB
5Accepted4/41ms1936 KiB
6Accepted4/41ms1932 KiB
7Runtime error0/432ms61672 KiB
8Accepted4/47ms10584 KiB
9Accepted4/41ms1952 KiB
10Accepted4/41ms1956 KiB
11Accepted4/410ms15924 KiB
12Runtime error0/427ms61688 KiB
13Runtime error0/425ms61692 KiB
14Accepted4/417ms25428 KiB
15Accepted2/21ms1976 KiB
16Accepted2/21ms1984 KiB