Submission #405544

# Submission time Handle Problem Language Result Execution time Memory
405544 2021-05-16T14:17:10 Z abdzag Fibonacci representations (CEOI18_fib) C++17
0 / 100
7 ms 2012 KB
#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 time Memory Grader output
1 Incorrect 4 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 2012 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -