|
||||||||||
Pty loves graphTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 133 Accepted Submission(s): 25 Problem Description 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. Input 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 Output For each test case, output ”Yes” or ”No” in one line. Sample Input
Sample Output
Source | ||||||||||
|