239212026-01-31 19:17:30TakacsAndrasJárdakövezés háromféle elemmelcpp17Accepted 30/303ms1116 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<pair<int,int>> dp(n+1);
    dp[0].first = 1;
    dp[1] = {2,2};
    for (int i = 2; i <= n; i++) {
        dp[i].first = (2*dp[i-1].first+2*dp[i-1].second+3*dp[i-2].first+2*dp[i-2].second)%2023;
        dp[i].second = (2*dp[i-1].first+dp[i-1].second)%2023;
    }
    cout << dp[n].first << '\n';
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/01ms500 KiB
2Accepted0/01ms332 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms380 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Accepted2/21ms748 KiB
10Accepted2/21ms568 KiB
11Accepted2/22ms820 KiB
12Accepted3/32ms820 KiB
13Accepted3/31ms508 KiB
14Accepted3/31ms316 KiB
15Accepted3/33ms1116 KiB