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

建议使用的浏览器:

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

4694:Important Sisters

题目描述
There are N clones of Misaka Mikoto (sisters) forming the Misaka network. Some pairs of sisters are connected so that one of them can pass message to the other one. The sister with serial number N is the source of all messages. All the other sisters get message directly or indirectly from her. There might be more than one path from sister #N to sister #I, but some sisters do appear in all of these paths. These sisters are called important sister of sister #K. What are the important sisters of each sister?
输入解释
There are multiple test cases. Process to the End of File.
The first line of each test case contains two integers: the number of sisters 1 ≤ N ≤ 50,000 and the number of connections 0 ≤ M ≤ 100,000. The following M lines are M connections 1 ≤ Ai, Bi ≤ N, indicating that Ai can pass message to Bi.
输出解释
For each test case, output the sum of the serial numbers of important sisters of each sister, separated with single space.
输入样例
3 2
3 2
2 1
5 7
3 2
1 2
2 1
3 1
3 2
5 3
5 4
输出样例
6 5 3
9 10 8 9 5
来自杭电HDUOJ的附加信息
Author Zejun Wu (watashi)
Recommend zhuyuanchen520

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

源链接: HDU-4694

最后修改于 2020-10-25T23:15:54+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
7000/7000MS(Java/Others) 131072/131072K(Java/Others)