#P8386. [PA 2021] Od deski do deski
[PA 2021] Od deski do deski
Problem Description
Given and , find the number of sequences of length that satisfy the following conditions:
- Each element is between .
- One operation is defined as deleting an interval of length at least whose two endpoints are equal. The sequence must be able to be completely deleted using several operations.
Output the answer modulo .
Input Format
The first line contains two positive integers and .
Output Format
Output one integer, which is the result modulo .
4 2
10
Hint
Sample Explanation
The valid sequences are:
Constraints
,。
Translated by ChatGPT 5