Score: 500 points
Does there exist an undirected graph with N vertices satisfying the following conditions?
If there exists such a graph, construct an example.
Input is given from Standard Input in the following format:
N K
If there does not exist an undirected graph with N vertices satisfying the conditions, print -1
.
If there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):
M u_1 v_1 : u_M v_M
If there exist multiple graphs satisfying the conditions, any of them will be accepted.
5 3
5 4 3 1 2 3 1 4 5 2 3
This graph has three pairs of vertices such that the shortest distance between them is 2: (1,\ 4), (2,\ 4), and (3,\ 5). Thus, the condition is satisfied.
5 8
-1
There is no graph satisfying the conditions.