15412022-11-22 18:33:59TomaSajtJardaTcpp14Accepted 40/403ms4568 KiB
#include <bits/stdc++.h>
#define speed ios::sync_with_stdio(0);cin.tie(0)
using namespace std;
const int mod = 20200111;

int main() {
    speed;
    int n; cin >> n;
    vector<long long> a(n + 1), b(n + 1);
    a[0] = 1;
    a[1] = 1;
    b[0] = 0;
    b[1] = 2;
    for (int i = 2; i <= n; i++) {
        a[i] = (a[i - 1] + a[i - 2] + b[i - 2]) % mod;
        b[i] = (b[i - 1] + b[i - 2] + 2 * a[i - 1]) % mod;
    }
    cout << a[n];
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1828 KiB
2Accepted0/02ms2016 KiB
3Accepted1/12ms2220 KiB
4Accepted1/12ms2424 KiB
5Accepted2/22ms2628 KiB
6Accepted2/22ms2832 KiB
7Accepted3/32ms3068 KiB
8Accepted3/32ms3268 KiB
9Accepted3/32ms3472 KiB
10Accepted3/32ms3576 KiB
11Accepted3/32ms3620 KiB
12Accepted3/32ms3756 KiB
13Accepted3/32ms3956 KiB
14Accepted3/32ms4184 KiB
15Accepted3/32ms4392 KiB
16Accepted3/32ms4460 KiB
17Accepted4/42ms4568 KiB