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

建议使用的浏览器:

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

5285:wyh2000 and pupil

题目描述
Young theoretical computer scientist wyh2000 is teaching his pupils.

Wyh2000 has n pupils.Id of them are from $1$ to $n$.In order to increase the cohesion between pupils,wyh2000 decide to divide them into 2 groups.Each group has at least 1 pupil.

Now that some pupils don't know each other(if $a$ doesn't know $b$,then $b$ doesn't know $a$).Wyh2000 hopes that if two pupils are in the same group,then they know each other,and the pupils of the first group must be as much as possible.

Please help wyh2000 determine the pupils of first group and second group. If there is no solution, print "Poor wyh".
输入解释
In the first line, there is an integer $T$ indicates the number of test cases.

For each case, the first line contains two integers $n,m$ indicate the number of pupil and the number of pupils don't konw each other.

In the next m lines,each line contains 2 intergers $x,y(x$<$y)$,indicates that $x$ don't know $y$ and $y$ don't know $x$,the pair $(x,y)$ will only appear once.

$T\leq10,0\leq n,m\leq100000$
输出解释
For each case, output the answer.
输入样例
2
8 5
3 4
5 6
1 2
5 8
3 5
5 4
2 3
4 5
3 4
2 4
输出样例
5 3
Poor wyh
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5285

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

共提交 0

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