AtCoder Regular Contest 174
E
Existence Counting
AtCoder
⌀ 2336
原题
← DF →
翻译中…

Problem Statement

翻译中…

You are given integers $N$ and $K$. Consider a sequence $a=(a_1,a_2,\dots,a_K)$ of length $K$ that satisfies all of the following conditions:

翻译中…
  • $a_i$ is an integer such that $1 \le a_i \le N$.
  • All elements in $a$ are different.
翻译中…

Let us arrange all possible sequences $a$ in lexicographical order to form a "sequence of sequences" called the dictionary $s$.

翻译中…

Given a sequence $P$ that exists in the dictionary $s$, answer the following question for each integer $t=1,2,\dots,N$:

翻译中…
  • Find the number, modulo $998244353$, of sequences $b$ that satisfy all of the following conditions:
  • The sequence $b$ exists in the dictionary $s$.
    • The integer $t$ is contained in the sequence $b$.
    • The sequence $b$ is lexicographically less than or equal to the sequence $P$.
翻译中…

What is lexicographical order for sequences? A sequence $A = (A_1, \ldots, A_{|A|})$ is lexicographically strictly less than $B = (B_1, \ldots, B_{|B|})$ if and only if 1. or 2. below is satisfied: $|A|<|B|$ and $(A_{1},\ldots,A_{|A|}) = (B_1,\ldots,B_{|A|})$. There is an integer $1\leq i\leq \min\{|A|,|B|\}$ that satisfies both of the following: $(A_{1},\ldots,A_{i-1}) = (B_1,\ldots,B_{i-1})$ $A_i < B_i$

翻译中…

Constraints

翻译中…
  • All input values are integers.
  • $1 \le K \le N \le 3 \times 10^5$
  • $P$ satisfies the condition in the problem statement.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K
P_1 P_2 \dots P_K

翻译中…

Output

翻译中…

Print $N$ lines in total. The $i$-th line should contain the answer to the problem for $t=i$ as an integer.

翻译中…

样例

Input #1
4 2
3 2
Output #1
5
5
4
2
In this input, $N=4,K=2$. Here, the dictionary $s$ is $((1,2),(1,3),(1,4),(2,1),(2,3),(2,4),(3,1),(3,2),(3,4),(4,1),(4,2),(4,3))$. Among the sequences in the dictionary $s$ that are lexicographically less than or equal to $(3,2)$, - five sequences contain $1$: $(1,2),(1,3),(1,4),(2,1),(3,1)$, - five sequences contain $2$: $(1,2),(2,1),(2,3),(2,4),(3,2)$, - four sequences contain $3$: $(1,3),(2,3),(3,1),(3,2)$, - two sequences contain $4$: $(1,4),(2,4)$.
Input #2
18 13
5 13 11 2 18 1 10 15 17 4 12 7 3
Output #2
925879409
905921009
665544804
665544719
783035803
349952762
349952758
349952757
349952757
349921178
212092637
710350150
378895603
129113201
129111892
129098081
129096772
110181652
题目信息
题号
arc174_e
时间限制
4 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。