64592023-12-02 13:40:41111JardaTcpp17Accepted 40/403ms4208 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define double long double

#define pii pair<int, int>

#define MOD 20200111

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifdef CB
	freopen("be2.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif
	int N;
	cin >> N;
	int a[N + 1][2] {};
	a[0][0] = 1;
	a[0][1] = 0;
	a[1][0] = 1;
	a[1][1] = 1;
	a[2][0] = 2;
	a[2][1] = 2;
	for (int i = 3; i <= N; i++) {
		a[i][0] = a[i - 1][0] + a[i - 2][1] * 2 + a[i - 2][0];
		a[i][1] = a[i - 1][1] + a[i - 1][0] + a[i - 2][1];
		a[i][0] %= MOD;
		a[i][1] %= MOD;
	}
	cout << a[N][0] << '\n';
	return 0;
}

SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1888 KiB
2Accepted0/03ms2128 KiB
3Accepted1/13ms2336 KiB
4Accepted1/13ms2544 KiB
5Accepted2/23ms2776 KiB
6Accepted2/23ms2928 KiB
7Accepted3/33ms3036 KiB
8Accepted3/33ms3064 KiB
9Accepted3/33ms3120 KiB
10Accepted3/33ms3348 KiB
11Accepted3/33ms3560 KiB
12Accepted3/33ms3776 KiB
13Accepted3/32ms3856 KiB
14Accepted3/33ms3996 KiB
15Accepted3/33ms4208 KiB
16Accepted3/33ms4188 KiB
17Accepted4/43ms4184 KiB