221792026-01-14 17:36:26algoproJárdakövezés háromféle elemmelcpp17Wrong answer 0/303ms1128 KiB
// UUID: 9127a0a3-2a43-4019-a8bf-50cf81ea456b
#include <bits/stdc++.h>
using namespace std;

const int MOD = 2023;

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
	vector<int> a(n + 1), b(n + 1);
    a[1] = 2; a[2] = 11; b[1] = 1; b[2] = 4;
    if (n < 3){
        cout << a[n];
        return 0; 
    }
    else {
        for (int i = 3; i <= n; i++){
            b[i] = (a[i - 1] + a[i - 2] + b[i - 1]) % MOD;
            a[i] = (a[i - 1] + a[i - 2] + b[i] + 3 * b[i - 1]) % MOD;
        }
    }
    cout << a[n];
}
SubtaskSumTestVerdictTimeMemory
base0/30
1Accepted0/01ms500 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms508 KiB
7Wrong answer0/21ms508 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/22ms568 KiB
10Wrong answer0/22ms664 KiB
11Wrong answer0/22ms1012 KiB
12Wrong answer0/33ms824 KiB
13Wrong answer0/31ms316 KiB
14Wrong answer0/31ms316 KiB
15Wrong answer0/33ms1128 KiB