当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7253:Tree

题目描述
You are given a directed graph with $n$ vertices and $m$ edges. The vertices are numbered from $1$ to $n$.

For each vertex $i$, find out the number of ways to choose exactly $n-1$ edges to form a tree, where all the other $n-1$ vertices can be reached from $i$ through these $n-1$ edges.
输入解释
The first line contains a single integer $T(1\le T\le 100)$ - the number of test cases.

For each test case:

The first line contains two integers $n,m(1\le n\le 500,0\le m \le n\times (n-1))$ - the number of vertices and the number of edges.

The next $m$ lines, each line contains two integers $x,y(1\le x,y\le n,x\neq y)$, denoting an edge. It is guaranteed that all the edges are different.

It is guaranteed that there are no more than $3$ test cases with $n>100$.

It is guaranteed that there are no more than $12$ test cases with $n>50$.
输出解释
For each test case, output $n$ integers in a line, the $i$-th integer denotes the answer for vertex $i$. Since the answer may be too large, print it after modulo $10^9+7$.

Please do not have any space at the end of the line.
输入样例
2
1 0
7 12
1 3
2 1
1 4
5 1
4 7
6 5
2 3
4 6
3 1
6 4
7 1
1 2
输出样例
1
2 3 1 4 2 6 2

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7253

最后修改于 2022-09-15T06:17:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
13000/6500MS(Java/Others) 524288/524288K(Java/Others)