Submission #1039274

#TimeUsernameProblemLanguageResultExecution timeMemory
1039274TrustfulcomicFibonacci representations (CEOI18_fib)C++14
0 / 100
1 ms600 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); for (int& i: a) cin >> i; vector<int> fibs(15); fibs[0] = 1; fibs[1] = 2; for (int i = 2; i<15; i++){ fibs[i] = fibs[i-1] + fibs[i-2]; } vector<int> dp(15*fibs.back()+1, 0); dp[0] = 1; for (int i : fibs){ for (int j = dp.size()-1; j >= 0; j--){ if (j-i >= 0) dp[j] += dp[j-i]; } } int cur = 0; for (int i = 0; i<n; i++){ cur += fibs[a[i]-1]; cout << dp[cur] << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...