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

建议使用的浏览器:

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

3236:Michelle's Evaluation

题目描述

After years of toil designing and evaluating varieties of complex networks, Michelle, an elite engineer, has recently made the decision to develop an assistant software to help herself out.

Consider a network built up with undirected water supply pipes each connecting a pair of junctions that supply or consume water. A shortcut of length L is defined as a sequence of  L distinct junctions such that two junctions are adjacent in the network if and only if they are adjacent in the sequence. A network is regarded speedy if there is no shortcut with a length greater than three.

Now, please try to work out an efficient solution for Michelle to determine whether a network is speedy or not.

输入解释

The input contains exactly one test case given as specified below:

Line 1Two integers N (1 < N < 1,200) and M, which are the numbers of junctions and pipes, respectively.
Line 2 – M + 1Two integer A and B (1 ≤ A, BN) on each line, describing a pipe connecting junctions A and B.

You can assume that there exists a path between any two junctions.

输出解释

Output “Yes” if the network is speedy, otherwise print “No”.

输入样例
4 4
1 2
2 3
3 4
4 1
输出样例
Yes

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3236

最后修改于 2020-10-29T06:56:31+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 131072