Submission #405544

#TimeUsernameProblemLanguageResultExecution timeMemory
405544abdzagFibonacci representations (CEOI18_fib)C++17
0 / 100
7 ms2012 KiB
#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 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...