CF1158F.Density of subarrays
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let c be some positive integer. Let's call an array a1,a2,…,an of positive integers c -array, if for all i condition 1≤ai≤c is satisfied. Let's call c -array b1,b2,…,bk a subarray of c -array a1,a2,…,an , if there exists such set of k indices 1≤i1<i2<…<ik≤n that bj=aij for all 1≤j≤k . Let's define density of c -array a1,a2,…,an as maximal non-negative integer p , such that any c -array, that contains p numbers is a subarray of a1,a2,…,an .
You are given a number c and some c -array a1,a2,…,an . For all 0≤p≤n find the number of sequences of indices 1≤i1<i2<…<ik≤n for all 1≤k≤n , such that density of array ai1,ai2,…,aik is equal to p . Find these numbers by modulo 998244353 , because they can be too large.
输入格式
The first line contains two integers n and c , separated by spaces ( 1≤n,c≤3000 ). The second line contains n integers a1,a2,…,an , separated by spaces ( 1≤ai≤c ).
输出格式
Print n+1 numbers s0,s1,…,sn . sp should be equal to the number of sequences of indices 1≤i1<i2<…<ik≤n for all 1≤k≤n by modulo 998244353 , such that the density of array ai1,ai2,…,aik is equal to p .
输入输出样例
输入#1
4 1 1 1 1 1
输出#1
0 4 6 4 1
输入#2
3 3 1 2 3
输出#2
6 1 0 0
输入#3
5 2 1 2 1 2 1
输出#3
10 17 4 0 0 0
说明/提示
In the first example, it's easy to see that the density of array will always be equal to its length. There exists 4 sequences with one index, 6 with two indices, 4 with three and 1 with four.
In the second example, the only sequence of indices, such that the array will have non-zero density is all indices because in other cases there won't be at least one number from 1 to 3 in the array, so it won't satisfy the condition of density for p≥1 .