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

建议使用的浏览器:

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

7083:Pty loves graph

题目描述
Given a undirected graph and a Hamiltonian cycle of it, output whether it is a planar graph.

For convenience, the indices of vertex are advancely relabeled so that the given Hamiltonian cycle is 1--2--3--4--...--(n-1)--n--1. The edges on this cycle are not given in the input.

Notice that there might be self loops and multiedges in the graph.

There are T test cases in total.
输入解释
The first line contains one integer T – the number of test cases.

For each test case:

The first line, two positive integer N,M - the number of vertices and edge besides the Hamiltonian cycle. Following m lines, two positive integer x,y, representing an edge (x,y)

1 ≤ T ≤ 26
1 ≤ N,M ≤ 5×$10^5$ , $\sum N$,$ \sum M ≤ 3 \times 10^6$.
1 ≤ x,y ≤ N
输出解释
For each test case, output ”Yes” or ”No” in one line.
输入样例
2
5 5
1 3
1 4
2 4
2 5
3 5
4 4
1 3
2 4
2 2
1 2

输出样例
No
Yes

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

源链接: HDU-7083

最后修改于 2021-10-23T19:11:21+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
20000/10000MS(Java/Others) 524288/524288K(Java/Others)