Check if a Graph is Complete
A graph is complete if all the vertices are connected to all the other vertices.
Given an undirected graph with
n
vertices and m
edges, you are asked to check if it’s a complete graph.
Input
The first line of the input contains two integers
n
(1 ≤ v ≤ 500) and m
(1 ≤ e ≤ 100 000).The following
m
lines contain pairs of integers v1
, v2
(1 ≤ v1, v2 ≤ v) which means that the vertex v1
is connected to the vertex v2
and vice versa. Output
The program should print
Yes
if the graph is complete and No
otherwise. Examples
Input | Output |
3 2
1 2
2 3
| No |
3 3
1 2
2 3
3 1 | Yes |
7 21
1 2
1 3
1 4
1 5
1 6
1 7
2 3
2 4
2 5
2 6
2 7
3 4
3 5
3 6
3 7
4 5
4 6
4 7
5 6
5 7
6 7 | Yes |
Constraints
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB