73642024-01-08 11:20:28anonToronyépítés (2,2,3,3)cpp17Accepted 40/404ms6408 KiB
#include <bits/stdc++.h>
#define MOD 20210108LL
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
int main() {
    FastIO;
    ll i, N;
    cin >> N;
    vector<ll> a(N + 1);
    a[0] = 1;
    a[1] = 0;
    a[2] = 2;
    a[3] = 2;
    for(i = 4; i <= N; i++)
        a[i] = (2 * a[i - 2] + 2 * a[i - 3]) % MOD;
    cout << a[N] << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1828 KiB
2Accepted0/03ms2200 KiB
3Accepted2/23ms2396 KiB
4Accepted2/23ms2532 KiB
5Accepted3/33ms2748 KiB
6Accepted3/33ms2932 KiB
7Accepted3/34ms6160 KiB
8Accepted3/34ms4836 KiB
9Accepted3/33ms3044 KiB
10Accepted3/33ms3184 KiB
11Accepted3/34ms6176 KiB
12Accepted3/34ms6408 KiB
13Accepted4/44ms6164 KiB
14Accepted4/44ms5416 KiB
15Accepted2/23ms3576 KiB
16Accepted2/23ms3684 KiB