115012024-10-14 11:17:04fazekas2028cToronyépítés (1,1,3,3)cpp17Time limit exceeded 18/50300ms21120 KiB
#include <bits/stdc++.h>
using namespace std;

//vector<int> dp;

int f(int x) {
	if(x==0)return 1;
	if(x<3)return f(x-1)*2;
	else return f(x-1)*2+f(x-3)*2;
}

int main() {
	int n;
	cin >> n;
	cout<<f(n);
	// //dp.resize(n+1)
	// //dp[0]=1;
	// for (int i = 1; i <= n; i++) {
	// 	dp[i]=dp[i-1]*2;
	// 	if(i>=3)dp[i]+=dp[i-3];
	// }
	// cout<<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Accepted0/01ms320 KiB
2Time limit exceeded0/0284ms500 KiB
3Accepted3/31ms320 KiB
4Accepted3/31ms320 KiB
5Wrong answer0/430ms400 KiB
6Wrong answer0/41ms320 KiB
7Time limit exceeded0/4300ms21120 KiB
8Time limit exceeded0/4300ms2872 KiB
9Accepted4/41ms320 KiB
10Accepted4/41ms320 KiB
11Time limit exceeded0/4300ms4408 KiB
12Time limit exceeded0/4287ms20792 KiB
13Time limit exceeded0/4280ms18480 KiB
14Time limit exceeded0/4300ms7224 KiB
15Accepted2/21ms320 KiB
16Accepted2/21ms320 KiB