Submission #584994

#TimeUsernameProblemLanguageResultExecution timeMemory
584994JomnoiFibonacci representations (CEOI18_fib)C++17
5 / 100
10 ms2864 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...