227202026-01-15 17:12:04algoproJárdakövezés háromféle elemmelcpp17Wrong answer 0/303ms1076 KiB
// UUID: 4cdfe854-fc55-412c-bdb5-e45ffc9425a4
#include <bits/stdc++.h>
using namespace std;

int main() {
    const int MOD = 2023;
    int n;
    cin >> n;

    vector<int> a(n + 1), b(n + 1);

    a[0] = 1;
    b[0] = 0;
    if (n >= 1) {
        a[1] = 2;
        b[1] = 1;
    }

    for (int i = 2; i <= n; i++) {
        b[i] = (a[i - 1] + b[i - 1] + a[i - 2]) % MOD;
        a[i] = (a[i - 1] + a[i - 2] + 2 * b[i]) % MOD;
    }

    cout << a[n] % MOD << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/30
1Accepted0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms332 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms564 KiB
10Wrong answer0/22ms564 KiB
11Wrong answer0/22ms1012 KiB
12Wrong answer0/33ms824 KiB
13Wrong answer0/31ms316 KiB
14Wrong answer0/31ms476 KiB
15Wrong answer0/33ms1076 KiB