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<unordered_map>
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b);i--)
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)
#define sz(a) a.size()
typedef long double ld;
using namespace std;
const long long inf = 1e15;
typedef long long ll;
typedef unsigned long long ull;
int main() {
cin.sync_with_stdio(false);
vector<ll> fibs(23);
fibs[0] = 1;
fibs[1] = 2;
rep(i, 2, 23)fibs[i] = fibs[i - 1] + fibs[i - 2];
vector<ll> dp(1e5);
dp[0] = 1;
rep(i, 0, fibs.size()) {
rrep(j, 1e5 - 1, -1) {
if (dp[j] && j + fibs[i] < 1e5) {
dp[j + fibs[i]]++;
}
}
}
rep(i, 0, 20)cout << dp[i] << " ";
cout << endl << endl;
ll n;
cin >> n;
vector<ll> v(n);
rep(i, 0, n) {
cin >> v[i];
}
ll cur = 0;
ll mod = 1e9 + 7;
rep(i, 0, n) {
cur += fibs[v[i] - 1];
cout << dp[cur] % mod << endl;
}
return 0;
}
# | 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... |