問題一覧 > 通常問題

No.1720 Division Permutation

レベル : / AI推定難易度 : 2500 / 実行時間制限 : 1ケース 4.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 15
作問者 : nok0 / テスター : zkou ygussany
お気に入りにしたユーザー ProblemId : 6961 / 自分の提出
問題文最終更新日: 2021-10-17 19:24:25
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 319 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。