atcoder#ARC077B. [ABC066D] 11
[ABC066D] 11
Score : points
Problem Statement
You are given an integer sequence of length , , which consists of the integers . It is known that each of the integers appears at least once in this sequence.
For each integer , find the number of the different subsequences (not necessarily contiguous) of the given sequence with length , modulo .
Notes
- If the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.
- A subsequence of a sequence with length is a sequence obtained by selecting of the elements of and arranging them without changing their relative order. For example, the sequences and are subsequences of , while and are not.
Constraints
- Each of the integers appears in the sequence.
- and are integers.
Input
Input is given from Standard Input in the following format:
...
Output
Print lines. The -th line should contain the number of the different subsequences of the given sequence with length , modulo .
3
1 2 1 3
3
5
4
1
There are three subsequences with length : and and .
There are five subsequences with length : and and and and .
There are four subsequences with length : and and and .
There is one subsequence with length : .
1
1 1
1
1
There is one subsequence with length : .
There is one subsequence with length : .
32
29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9
32
525
5453
40919
237336
1107568
4272048
13884156
38567100
92561040
193536720
354817320
573166440
818809200
37158313
166803103
166803103
37158313
818809200
573166440
354817320
193536720
92561040
38567100
13884156
4272048
1107568
237336
40920
5456
528
33
1
Be sure to print the numbers modulo .