atcoder#ARC148E. [ARC148E] ≥ K
[ARC148E] ≥ K
Score : points
Problem Statement
You are given a sequence of length , , and an integer . How many permutations of are there such that no two adjacent elements sum to less than ? Find the count modulo .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
4 5
1 2 3 4
4
The following four permutations satisfy the condition:
4 3
1 2 3 3
12
There are permutations of , all of which satisfy the condition.
10 7
3 1 4 1 5 9 2 6 5 3
108