35692023-03-01 08:21:311478Járdakövezés háromféle elemmelcpp17Accepted 30/304ms4788 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //ifstream cin("in.txt");
    int n;
    cin >> n;
    vector<int> e(n + 1);
    vector<int> he(n + 1);
    e[0] = 1;
    e[1] = 2;
    he[0] = 0;
    he[1] = 2;

    for(int i = 2; i <= n; i++){
        e[i] = (2 * e[i - 1] + 3 * e[i - 2] + 2 * he[i - 1]) % 2023;
        he[i] = (he[i - 1] + 2 * e[i - 2] + 2 * e[i - 1]) % 2023;
    }

    cout << e[n];



    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1832 KiB
2Accepted0/03ms2056 KiB
3Accepted2/23ms2296 KiB
4Accepted2/23ms2368 KiB
5Accepted2/22ms2456 KiB
6Accepted2/22ms2456 KiB
7Accepted2/23ms2664 KiB
8Accepted2/23ms2880 KiB
9Accepted2/23ms3204 KiB
10Accepted2/23ms3384 KiB
11Accepted2/24ms3820 KiB
12Accepted3/34ms4168 KiB
13Accepted3/33ms3452 KiB
14Accepted3/33ms3504 KiB
15Accepted3/34ms4788 KiB