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

建议使用的浏览器:

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

3380:Circle of Friends

题目描述
After measuring the strength of friendships between different Navi, Grace wants to find groups of Navi who form close-knit friendships. A group of friends has strength k if each Navi in the group has at least k friends within the group. Your goal is to help Grace find the strongest, largest circle of friends for individual Navi.
输入解释
Connections between Navi are described beginning with the line “GRAPH BEGIN”. Additional lines lists individual Navi, followed (on the same line) by their friends. The line ”GRAPH END” ends the list of connection descriptions. The next lines describe individual Navi to be analyzed, each on a single line. Following these lines, a completely new instance of the problem can be given, starting from scratch.

Some Navi may be only be listed as friends of other Navi (i.e., not all Navi will have their connections listed on a separate line).
输出解释
Your output should consist of one line for each Navi analyzed, in the same order they were listed in the input. Each line should contain the name of the Navi, the largest k for which the Navi is a member of some group of friends of strength k, and all the friends in that group (in alphabetical order), including themselves. Every Navi in the group must know the initial Navi either directly or indirectly through some sequence of common friends (i.e., the friendship graph must be connected).

In the example below, Navi c is a member of a group of friends of strength 3: bcde. She is also a member of several groups of friends of strength 2 (bcd, bce, cde, . . . ) but because 3 > 2, the group of strength 3 is the one that should be output.

Navi f is a member of several groups of strength 1 (ef, bef, def, . . . ) but the largest one is abcdef, so that is the one that should be output.

输入样例
GRAPH BEGIN 
a b c 
b c d e 
c d e 
e d f 
GRAPH END
a
b
c
d
e
f
输出样例
a 2 a b c d e
b 3 b c d e
c 3 b c d e
d 3 b c d e
e 3 b c d e
f 1 a b c d e f
来自杭电HDUOJ的附加信息
Recommend lcy

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

题目来源 2010 MHSPC

源链接: HDU-3380

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)