# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78912 | aminra | Fibonacci representations (CEOI18_fib) | C++14 | 2391 ms | 680 KiB |
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;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)107;
const int infint = (int)1e9;
ll n, a[MAXN], dp1[MAXN], dp2[MAXN];
vector<int> v;
ll get()
{
dp1[0] = 1, dp2[0] = 0;
for (int i = 1; i < v.size(); i++)
dp1[i] = (dp1[i - 1] + dp2[i - 1]) % MOD, dp2[i] = dp1[i - 1] * ((v[i] - v[i - 1] - 1) / 2) % MOD + dp2[i - 1] * ((v[i] - v[i - 1]) / 2) % MOD, dp2[i] %= MOD;
return (dp1[v.size() - 1] + dp2[v.size() - 1]) % MOD;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
v.push_back(0);
for (int i = 0; i < n; i++)
{
v.push_back(a[i]);
sort(v.begin(), v.end());
cout << get() << " ";
}
}
Compilation message (stderr)
# | 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... |