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

建议使用的浏览器:

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

5215:Cycle

题目描述
Ery is interested in graph theory, today he ask BrotherK a problem about it: Given you a undirected graph with $N$ vertexes and $M$ edges, you can select a vertex as your starting point, then you need to walk in the graph along edges. However, you can't pass a edge more than once, even opposite direction is forbidden. At the end, you should come back to the starting point. Assume you has passed $X$ edges, there are two questions:

Question 1: Can $X$ be a odd number ?

Question 2: Can $X$ be a even number ?

(note: you must walk, so $X$ can't be 0)
输入解释
The first line contains a single integer $T$, indicating the number of test cases.

Each test case begins with two integer $N,~M$, indicating the number of vertexes and the number of edges. Following $M$ lines, each line contains two integers $U_i,~V_i$, indicating there are a edge between vertex $U_i$ and vertex $V_i$.

$T$ is about 30

$1~\le~N~\le~100000$

$0~\le~M~\le~300000$

$1~\le~U_i, V_i~\le~N$

$U_i$ will not equal to $V_i$

There is at most one edge between any pair of vertex.
输出解释
For each test, print two lines.

The first line contains "YES" or "NO" for question 1.

The second line contains "YES" or "NO" for question 2.
输入样例
3
1 0
3 3
1 2
2 3
3 1
4 4
1 2
2 3
3 4
4 1
输出样例
NO
NO
YES
NO
NO
YES

提示
If you need a larger stack size, 
please use #pragma comment(linker, "/STACK:102400000,102400000") and submit your solution using C++.
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5215

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

共提交 0

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