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>
#include <iostream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
int n;
const int maxf = 20;
const int p2f = 1048576;
vi f(maxf);
void getf() {
f[0] = 1; f[1] = 2;
rep(i,2,maxf) f[i] = f[i - 2] + f[i - 1];
}
ll ways(int x) {
int ways = 0;
rep(ss, 0, p2f) {
ll s = 0;
rep(i,0,maxf) {
if (ss & (1<<i)) s += f[i];
}
if (s == x) ways++;
}
return ways;
}
int main()
{
cin >> n;
getf();
int des = 0;
rep(i,0,n) {
int x; cin >> x; des += f[x-1];
cout << ways(des) << 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... |