시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 8 | 7 | 7 | 87.500% |
There are $n$ nodes, the $i$-th of which has color $c_i$. For a given integer $k$ ($1 \le k \le n$), please count the number of ways to build exactly $n - 1$ undirected edges between the nodes, such that:
Two ways of building edges are considered different if and only if there exist two nodes $i$ and $j$ such that $1 \le i < j \le n$ and there is an edge between them in one of the two ways but not in the other.
Since the number could be large, you only need to output the answer modulo $10^9 + 7$.
The first line contains two integers, $n$ and $k$ ($1 \le k \le n \le 300$).
The following $n$ lines contain integers $c_1, c_2, \ldots, c_n$ denoting the colors of the nodes, one integer per line ($1 \le c_i \le n$).
Output the answer modulo $10^9 + 7$.
5 3 1 1 3 1 5
125
4 2 2 1 1 1
7