383. Is Everyone Joined to Everyone
Print Yes if every pair of distinct vertices is joined by an edge, and No
otherwise.
A graph like that is called complete. There are n × (n - 1) / 2 pairs of
distinct vertices, so a complete graph has exactly that many edges, and since
the input promises no repeated edges, comparing m against that number decides
it on its own.
Watch the arithmetic. With n at its largest, n × (n - 1) / 2 is about five
billion, which does not fit in a 32-bit integer. Use a 64-bit type, or divide
before multiplying.
A single vertex has no pairs to join, so it is complete with 0 edges.
Constraints - `1 ≤ n ≤ 100000` - `0 ≤ m ≤ 200000` - There are no self-loops and no repeated edges.
Input
The first line contains two integers n and m, the number of vertices and
edges. Each of the next m lines contains two integers u and v, an
undirected edge between those vertices. Vertices are numbered 1 to n.
Output
Print Yes or No on one line.