Decreasing Sequences of Points
Time limit1sMemory limit256 MB
Count sequences of lattice points on the diagonals x+y=a_i with nondecreasing x and nonincreasing y.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Prefix sum
- Solved
- No attempts yet
Problem
Consider a sequence of distinct points with nonnegative integer coordinates. The sequence is decreasing if and for every .
Count how many decreasing sequences satisfy .
Input
The first line contains a positive integer . The second line contains nonnegative integers .
Output
Print the number of valid sequences modulo .