3712021-11-03 07:56:42kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Runtime error 38/5052ms61692 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];
    }
    return variationS[n] = (2 * variations(n - 1) + 2 * variations(n - 3)) % 20210108;
}

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/02ms1816 KiB
2Accepted0/01ms2052 KiB
3Accepted3/31ms1924 KiB
4Accepted3/31ms1924 KiB
5Accepted4/42ms1936 KiB
6Accepted4/41ms1932 KiB
7Runtime error0/452ms61596 KiB
8Accepted4/47ms10580 KiB
9Accepted4/41ms1944 KiB
10Accepted4/42ms1952 KiB
11Accepted4/410ms15924 KiB
12Runtime error0/435ms61688 KiB
13Runtime error0/428ms61692 KiB
14Accepted4/417ms25420 KiB
15Accepted2/21ms1968 KiB
16Accepted2/21ms1976 KiB