Submission #78912

#TimeUsernameProblemLanguageResultExecution timeMemory
78912aminraFibonacci representations (CEOI18_fib)C++14
15 / 100
2391 ms680 KiB
#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)

fib.cpp: In function 'll get()':
fib.cpp:13:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < v.size(); i++)
                  ~~^~~~~~~~~~
#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...