70522023-12-29 07:24:47MagyarKendeSZLGToronyépítés (80 pont)cpp17Accepted 80/8010ms11080 KiB
#include <bits/stdc++.h>

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

using namespace std;

int main() {
    speed;

    int N;
    cin >> N;
    vector<int> dp(N + 1);
    dp[0] = 1;
    for (int i = 1; i <= N; i++) {
        dp[i] = (long)(dp[i - 1] * 3 + (i >= 2 ? dp[i - 2] : 0)) % 20210108;
    }
    cout << dp[N];
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1828 KiB
2Accepted0/03ms2064 KiB
3Accepted4/43ms2268 KiB
4Accepted4/43ms2476 KiB
5Accepted5/53ms2660 KiB
6Accepted5/52ms2736 KiB
7Accepted6/610ms10680 KiB
8Accepted6/64ms3900 KiB
9Accepted7/73ms3168 KiB
10Accepted7/73ms3164 KiB
11Accepted8/84ms4656 KiB
12Accepted8/810ms11080 KiB
13Accepted8/89ms10128 KiB
14Accepted8/84ms5836 KiB
15Accepted2/23ms3460 KiB
16Accepted2/23ms3604 KiB