Score : $600$ points
There are $N$ balls numbered $1$ through $N$. Ball $i$ is painted in Color $a_i$.
For a permutation $P = (P_1, P_2, \dots, P_N)$ of $(1, 2, \dots, N)$, let us define $C(P)$ as follows:
Let $S_N$ be the set of all permutations of $(1, 2, \dots, N)$. Also, let us define $F(k)$ by:
Enumerate $F(1), F(2), \dots, F(M)$.
Input is given from Standard Input in the following format:
$N$ $M$ $a_1$ $a_2$ $\dots$ $a_N$
Print the answers in the following format:
$F(1)$ $F(2)$ $\dots$ $F(M)$
3 4 1 1 2
8 12 20 36
Here is the list of all possible pairs of $(P, C(P))$.
We may obtain the answers by assigning these values into $F(k)$. For instance, $F(1) = 1^1 + 2^1 + 1^1 + 2^1 + 1^1 + 1^1 = 8$.
2 1 1 1
0
10 5 3 1 4 1 5 9 2 6 5 3
30481920 257886720 199419134 838462446 196874334