21972023-01-02 10:33:14kohumarkJardaTcpp11Accepted 40/403ms4036 KiB
#include <iostream>
using namespace std;

int main(){
	int n; cin >> n;
	int a[n]; int b[n];
	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]) % 20200111;
		b[i] = (b[i-2] + a[i-1]*2 + b[i-1]) % 20200111;
	}
	cout << a[n] ;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1880 KiB
2Accepted0/02ms2064 KiB
3Accepted1/12ms2276 KiB
4Accepted1/12ms2348 KiB
5Accepted2/22ms2480 KiB
6Accepted2/22ms2576 KiB
7Accepted3/32ms2800 KiB
8Accepted3/32ms3004 KiB
9Accepted3/32ms3080 KiB
10Accepted3/32ms3304 KiB
11Accepted3/32ms3516 KiB
12Accepted3/32ms3580 KiB
13Accepted3/32ms3708 KiB
14Accepted3/32ms3788 KiB
15Accepted3/32ms4036 KiB
16Accepted3/32ms3992 KiB
17Accepted4/42ms3876 KiB