73922024-01-08 13:31:02EsVagyJárdakövezés háromféle elemmelcpp17Accepted 30/3032ms5512 KiB
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <climits>
#include <queue>
#include <fstream>
#include <sstream>
#include <math.h>
#include <list>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int size;
    cin >> size;

    vector<int> noStep(size + 1, 0);
    vector<int> step(size + 1, 0);
    vector<int> singleStep(size + 1, 0);
    noStep[0] = 1;
    noStep[1] = 2;
    singleStep[1] = 2;

    for (int i = 2; i <= size; i++)
    {
        int stepNext = step[i - 1] + 2 * noStep[i - 2] + singleStep[i - 1];
        int singleStepNext = 2 * noStep[i - 1];
        int noStepNext = noStep[i - 2] + noStep[i - 1] + step[i - 1] + stepNext + singleStepNext / 2 + singleStep[i - 1];
        step[i] = stepNext % 2023;
        noStep[i] = noStepNext % 2023;
        singleStep[i] = singleStepNext % 2023;
    }

    for (int i = 0; i <= size; i++)
    {
        clog << noStep[i] << " " << step[i] << " " << singleStep[i] << "\n";
    }

    cout << noStep[size] << "\n";
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1828 KiB
2Accepted0/03ms2164 KiB
3Accepted2/23ms2160 KiB
4Accepted2/23ms2348 KiB
5Accepted2/23ms2456 KiB
6Accepted2/23ms2704 KiB
7Accepted2/23ms2608 KiB
8Accepted2/23ms2800 KiB
9Accepted2/210ms3680 KiB
10Accepted2/212ms3956 KiB
11Accepted2/221ms4592 KiB
12Accepted3/326ms4984 KiB
13Accepted3/34ms3560 KiB
14Accepted3/36ms3456 KiB
15Accepted3/332ms5512 KiB