ETA
문제
You want to design a level for a computer game. The level can be described as a connected undirected graph with vertices numbered from to . In the game, the player's character is dropped at one of the vertices uniformly at random and their goal is to reach the exit located at vertex as quickly as possible. Traversing an edge takes exactly second.
Figure E.1: Illustration of Sample Output 3, a level where the average optimal time to reach vertex is .
The difficulty of the level is determined by the average optimal time to reach the exit. Given a target value for this average optimal time, construct a level so that this target value is reached. See Figure E.1 for an example.
입력
The input consists of:
- One line with two coprime integers and () separated by a '
/', giving the desired average optimal time to reach the exit as the fraction .
출력
If no connected graph with the average optimal time to reach vertex exists, output "impossible". Otherwise, output one such graph in the following format:
- Two integers and (), the number of vertices and the number of edges.
- pairs of integers and (), indicating an edge between vertices and .
The graph may include self loops and parallel edges. You are given that if there exists a valid graph, then there also exists one with .
If there are multiple valid solutions, you may output any one of them.
예제
예제 1
1/2
2 1 1 2
예제 2
1/3
impossible
예제 3
7/4
8 12 1 2 1 3 2 3 2 4 3 5 3 6 4 5 5 6 4 7 5 7 4 8 6 8