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;
const int MAX_W = 150005;
const int MAX_N = 1e5 + 5;
const int MOD = 1e9 + 7;
int A[MAX_N];
long long f[MAX_N];
long long dp[MAX_W];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int N;
cin >> N;
f[1] = 1;
f[2] = 2;
for(int i = 3; i <= 50; i++) {
f[i] = f[i - 1] + f[i - 2];
}
dp[0] = 1;
for(int i = 1; i <= 50; i++) {
for(int j = MAX_W; j >= f[i]; j--) {
dp[j] += dp[j - f[i]];
dp[j] %= MOD;
}
}
int prefix = 0;
for(int i = 1; i <= N; i++) {
cin >> A[i];
prefix += f[A[i]];
cout << dp[prefix] << '\n';
}
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... |