80972024-01-12 13:06:24anonJardaTcpp17Accepted 40/403ms3984 KiB
#include <bits/stdc++.h>
#define MOD 20200111LL
#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);
    vector<ll> b(N + 1);
    a[0] = 1;
    a[1] = 1;
    a[2] = 2;
    b[0] = 1;
    b[1] = 0;
    b[2] = 2;
    for(i = 3; i <= N; i++) {
        a[i] = (a[i - 1] + a[i - 2] + b[i - 1]) % MOD;
        b[i] = (b[i - 2] + b[i - 1] + 2 * a[i - 2]) % MOD;
    }
    cout << a[N] << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1832 KiB
2Accepted0/03ms2032 KiB
3Accepted1/13ms2236 KiB
4Accepted1/13ms2468 KiB
5Accepted2/23ms2704 KiB
6Accepted2/23ms2932 KiB
7Accepted3/33ms2896 KiB
8Accepted3/33ms3024 KiB
9Accepted3/33ms3228 KiB
10Accepted3/33ms3308 KiB
11Accepted3/33ms3444 KiB
12Accepted3/33ms3532 KiB
13Accepted3/33ms3520 KiB
14Accepted3/33ms3756 KiB
15Accepted3/33ms3984 KiB
16Accepted3/33ms3972 KiB
17Accepted4/43ms3976 KiB