Campus Roads


Submit solution

Points: 1
Time limit: 5.0s
Memory limit: 256M

Author:
Problem type

Problem

NGU has a beautiful campus. The authority of NGU has decided to take some more steps about beautification of this campus. One of these steps is tree plantation in some roads. To complete this project they will select some roads, and for any road they will also select a number that how many trees will be planted on that road. To make this campus more beautiful they decided in a single road, the gap between any two adjacent trees will be fixed, and this gap will be as large as possible. So If you walk through the road in a constant speed, you will reach a tree after constant intervals. A road can be described by \(K\) points \(P_1, P_2,\dots , P_K\). \(P_i\) and \(P_{i+1}\) are connected by a straight line. So, it is clear that a road consists of some contiguous straight lines. In this problem you have to find all the points where to plant a tree. For the sake of simplicity, we will consider that roads will not have any width.

Input

The first line of input is an integer \(N\) \((N < 100)\) that indicates the number of roads under this beautification project. From the next line, \(N\) roads are described one by one. The description of each road starts with a line containing two integers \(K\) \((2 ≤ K ≤ 100)\) and \(T\) \((2 ≤ T ≤ 100)\). Here \(K\) indicates the number of points that represents the road, and \(T\) represents the number of trees to be planted. This line is followed by \(K\) lines having 2 decimals \(x, y\) \((-1000.00 ≤ x ≤ 1000.00 \text{ and } -1000.00 ≤ y ≤ 1000.00)\) each. Every \(i\)-th line of these \(K\) lines is the co-ordinate of \(P_i\).

Output

You have to give your output for every roads one by one. Output of each road starts with a line Road #n:, here \(n\) is the road number. The next \(T\) lines will give the co-ordinates of trees to be planted. Each \(x, y\) co-ordinate will be separated by a single space and having two decimal points. You have to represent the points sequentially in the order in which order you will find those trees when you walk through the road \(P_1\) to \(P_K\). Print a blank line after describing each road.

Hint: You have to maximize the distance between two adjacent trees in a road. So it is sure that first and last tree will be on the first and last point, i.e. in \(P_1\) and \(P_K\).

Sample

Input
2
5 6
10.00 10.00
20.00 20.00
30.00 10.00
10.00 0.00
9.00 9.00
3 2
0.00 0.00
10.00 10.00
20.00 20.00
Output
Road #1:
10.00 10.00
18.44 18.44
26.89 13.11
23.26 6.63
12.58 1.29
9.00 9.00

Road #2:
0.00 0.00
20.00 20.00

Comments

There are no comments at the moment.