Submission #942863

# Submission time Handle Problem Language Result Execution time Memory
942863 2024-03-11T05:37:46 Z vjudge1 Fibonacci representations (CEOI18_fib) C++17
0 / 100
1 ms 604 KB
#include <bits/stdc++.h>
 
using namespace std;

#define int long long

void solve(){

	vector<int> fb(16);
	fb[1] = 1;
	fb[2] = 2;
	for(int i = 3;i <= 15;i++){
		fb[i] = fb[i - 1] + fb[i - 2];
	}
	int sum = 15000;
	vector<int> dp(sum + 1);
	dp[0] = 1;
	for(int i = 1;i <= 15;i++){
		for(int j = sum;j >= 0;j--){
			if(j + fb[i] <= sum){
				dp[j + fb[i]] += dp[j];
			}
		}
	}
	int n;
	cin >> n;
	int pref = 0;
	for(int i = 0;i < n;i++){
		int a;
		cin >> a;
		pref += fb[a];
		cout << dp[pref] << "\n";
	}
	
}
 
signed main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	
	int t = 1;
	//~ cin >> t;
	while(t--){
		solve();
	}
}
	
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -