Problem 3819 --Pty loves graph

3819: Pty loves graph

"
Time Limit $10$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 图论
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×105 , ∑N,∑M≤3×106
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

推荐代码 查看3819 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛