227422026-01-15 17:37:45algoproJárdakövezés háromféle elemmelcpp17Wrong answer 0/304ms1844 KiB
// UUID: 057f1e80-23e7-4062-ad48-eff63eaf37e7
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll, ll>;

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n; cin >> n;
	vector<ll> a(n+1), b(n+1);
	a[0]=1;
	a[1]=2;
	b[0]=0;
	b[1]=1;
	for (ll i=2; i<=n; i++){
		b[i]=(a[i-1]+b[i-1]+a[i-2])%2023;
		a[i]=(b[i] + b[i-1]*2+a[i-1]+a[i-2]+b[i-1]*2)%2023;
	} // modulo 2023
	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/21ms500 KiB
7Wrong answer0/21ms332 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/22ms696 KiB
10Wrong answer0/22ms820 KiB
11Wrong answer0/23ms1476 KiB
12Wrong answer0/33ms1588 KiB
13Wrong answer0/31ms316 KiB
14Wrong answer0/31ms564 KiB
15Wrong answer0/34ms1844 KiB