#P7278. 纯洁憧憬
纯洁憧憬
Description
Given a permutation of order and an interval , if $\max\limits_{l\le i\le r} p_i - \min\limits_{l\le i\le r} p_i = r - l$, then is called a consecutive segment.
For a consecutive segment , if it satisfies , then is called a non-trivial consecutive segment.
The boy’s thoughts can be abstracted as a permutation that has at least one non-trivial consecutive segment with length greater than .
The boy will give and ask you how many permutations of order can be the boy’s thoughts. Output the answer modulo .
Input Format
The first line contains two positive integers .
Output Format
One line containing one non-negative integer, representing the answer.
3 2
0
4 2
20
Hint
For of the testdata, .
For of the testdata, .
Sample Explanation
For the second sample, there are permutations that do not satisfy the condition:
- .
- .
- .
- .
The other cases all satisfy the condition and can be the boy’s thoughts.
Translated by ChatGPT 5
京公网安备 11011102002149号