Martian Pranks

Time limit1sMemory limit128 MB

Summary
Pair rocks between two unit-square snapshots to minimize the maximum move time, where moving a rock costs d(A)+2|AB|+d(B), then divide by t.
Level

Hard8 of 10

Topics
Binary search, Graph, Math, Geometry
Solved
No attempts yet

Problem

Martians love pranks. When they realized that a strange new rover was taking pictures of their planet for scientific study, they decided to confuse the scientists on Earth by rearranging rocks between shots. Whenever the rover photographs the same spot twice, tt seconds apart, some rocks have moved.

The scene is the unit square [0,1]×[0,1][0,1]\times[0,1]. A picture is a list of nn rock positions (xi,yi)(x_i, y_i) with every coordinate in [0,1][0,1]. Both pictures contain the same number of rocks, but the scientists cannot tell individual rocks apart, so any rock in the first picture may correspond to any rock in the second picture.

An effectively unlimited number of Martians wait just outside the square, and every Martian runs at the same speed vv (units per second). To move one rock, the Martian nearest to it runs straight to the rock at speed vv (the run-in distance is the distance from the rock to the nearest edge of the square), pushes it to its new position at speed v/2v/2 (the rock is heavy), and then leaves the picture at speed vv by the shortest route (the distance from the new position to the nearest edge). A rock that is not moved needs no Martian and takes no time.

Because each rock is handled by a different Martian, all moves happen in parallel, so the rearrangement finishes as soon as the slowest single move finishes. The Martians may freely choose which first-picture rock becomes which second-picture rock. Find the smallest speed vv for which they can follow this protocol and finish every move within tt seconds.

Let d(P)=min⁡(x, 1−x, y, 1−y)d(P)=\min(x,\,1-x,\,y,\,1-y) be the distance from a point P=(x,y)P=(x,y) to the nearest edge of the square. Moving a rock from AA to a different position BB takes time (d(A)+2 ∣AB∣+d(B))/v\big(d(A)+2\,|AB|+d(B)\big)/v, while leaving a rock in place takes time 00. For a chosen pairing the smallest feasible speed is (the largest move cost) divided by tt; the answer is the minimum of this value over all pairings.

Input

The first line contains the number of data sets KK. The KK data sets follow.

The first line of a data set contains an integer nn and a real number tt. The next 2n2n lines each contain two real numbers xx and yy: the first nn lines are the rock positions in the first picture, and the following nn lines are the positions in the second picture. The rocks are listed in arbitrary order (they cannot be told apart), and several rocks may share the same position.

Constraints: 0≤n≤1000 \le n \le 100, t≥1.0t \ge 1.0, and 0≤x,y≤10 \le x, y \le 1.

Output

For each data set, print Data Set x: on its own line, where xx is the data set's number starting from 11. On the next line print the smallest speed vv, rounded to two decimal places. Print one blank line between consecutive data sets.

Examples3

  1. Example 1

    Input
    1
    4 3.0
    0.3 0.6
    0.4 0.5
    0.5 0.5
    0.95 0.2
    0.6 0.5
    0.9 0.4
    0.5 0.5
    0.3 0.6
    
    Expected output
    Data Set 1:
    0.37
    
  2. Example 2

    Input
    1
    1 1.0
    0.5 0.5
    0.5 0.9
    
    Expected output
    Data Set 1:
    1.40
    
  3. Example 3

    Input
    1
    1 2.0
    0.3 0.3
    0.3 0.3
    
    Expected output
    Data Set 1:
    0.00