Fibonacci representations
Time limit2sMemory limit512 MB
Given a sequence a, report after each prefix the number of ways to write the sum of F_{a_i} as distinct Fibonacci numbers, modulo 1e9+7.
- Level
Hard9 of 10
- Topics
- Segment tree, Dynamic programming, Matrix
- Solved
- No attempts yet
Statement
The Fibonacci sequence is defined as:
- for
The first few terms are
For a positive integer , let be the number of different ways to write as a sum of distinct Fibonacci numbers. Two ways differ if some Fibonacci number appears in exactly one of them.
You are given a sequence of positive integers . For each non-empty prefix , define . Find modulo for every .
Input
The first line contains an integer (). The second line contains space-separated integers ().
Output
Print lines. The -th line contains modulo .