No.1720 Division Permutation
Problem Statement
A sequence $A$ is called a beautiful sequence if, when $A$ is sorted in ascending order, all differences between adjacent elements are $1$. For example, $(5,2,4,3,7,6)$, $(1,2,3)$, and $(7)$ are beautiful sequences, while $(1,3,5,7)$ and $(2,3,4,5,7)$ are not beautiful sequences.
You are given a permutation $P$ of length $N$, obtained by rearranging $(1,2,\dots,N)$.
Divide the permutation $P$ into $X$ contiguous subarrays $B_1,B_2,\dots,B_X$ so that all of the following conditions are satisfied.
- Each of $B_1,B_2,\dots,B_X$ is a non-empty contiguous subarray of $P$ and is a beautiful sequence.
- Concatenating $B_1,B_2,\dots,B_X$ in this order yields $P$.
For each of $X=1,2,\dots,K$, find the number of divisions satisfying the conditions, modulo $\bmod 998244353$.
Constraints
- All input values are integers.
- $1 \le N \le 2 \times 10^5$
- $1 \le K \le \mathrm{min}(N,$ $10$$)$
- $P$ is a permutation obtained by rearranging $(1,2,\dots,N)$.
Input
$N$ $K$ $P_1$ $P_2$ $\dots$ $P_N$
Output
On the $i\ (1\le i \le K)$-th line, print the answer for $X=i$.
Sample
Sample 1
Input
4 2 1 3 2 4
Output
1 2
For $X=1$, the division $(1,3,2,4)$ satisfies the conditions.
For $X=2$, the division $(1,3,2),(4)$ and the division $(1),(3,2,4)$ satisfy the conditions.
Sample 2
Input
5 3 1 2 3 4 5
Output
1 4 6
All divisions into $X=1,2,3$ non-empty contiguous subarrays satisfy the conditions.
Sample 3
Input
10 10 1 3 2 4 5 8 9 7 6 10
Output
1 5 10 13 16 17 14 9 4 1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
nok0