227342026-01-15 17:31:16algoproJárdakövezés háromféle elemmelcpp17Accepted 30/303ms1076 KiB
// UUID: 08531dcf-d93f-4064-be6f-cac7cbef8135
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<array<int,2>> jarda(n+1);
	jarda[0][0]=1; jarda[0][1]=0; jarda[1][1]=1; jarda[1][0]=2;
	for (int i=2;i<=n;i++){
		jarda[i][1]=(jarda[i-1][0]+jarda[i-1][1]+jarda[i-2][0])%2023;
		jarda[i][0]=(jarda[i][1]+jarda[i-1][0]+jarda[i-2][0]*2+jarda[i-1][1]*3)%2023;
	}
	cout << jarda[n][0]%2023;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/01ms508 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Accepted2/22ms564 KiB
10Accepted2/22ms664 KiB
11Accepted2/22ms820 KiB
12Accepted3/32ms820 KiB
13Accepted3/31ms316 KiB
14Accepted3/31ms316 KiB
15Accepted3/33ms1076 KiB