This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |