239222026-01-31 19:17:48algoproJárdakövezés háromféle elemmelcpp17Accepted 30/302ms1076 KiB
// UUID: a1712aa7-b5e8-4316-aece-db84f0fe0c27
#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/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms512 KiB
4Accepted2/21ms512 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms508 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms500 KiB
9Accepted2/21ms564 KiB
10Accepted2/21ms568 KiB
11Accepted2/22ms820 KiB
12Accepted3/32ms820 KiB
13Accepted3/31ms316 KiB
14Accepted3/31ms480 KiB
15Accepted3/32ms1076 KiB