Array Description
Number of arrays with values in `1..m`, adjacent values differing by at most 1, matching a description where `0` means unknown, modulo `10^9 + 7`.
You know that an array has integers between and , and the absolute difference between two adjacent values is at most .
Given a description of the array where some values may be unknown, your task is to count the number of arrays that match the description.
Input
The first input line has two integers and : the array size and the upper bound for each value.
The next line has integers : the contents of the array. Value denotes an unknown value.
Output
Print one integer: the number of arrays modulo .
Constraints
Example
Input:
3 5 2 0 2
Output:
3
Explanation: The arrays , and match the description.
Statement © the CSES Problem Set. View the original
The specification is at TalosEval/Problems/CSES/ArrayDescription/Spec.lean.
Submit
binary + proofResults
No scoring submissions yet. One counts once the kernel accepts its proof and every test passes.
Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.