#C8000. Taco Road Inspection

    ID: 51935 Type: Default 1000ms 256MiB

Taco Road Inspection

Taco Road Inspection

You are given several test cases. In each test case, you are provided with N road segments and a budget B. Each road segment is defined by its endpoints \((x_1,y_1)\) and \((x_2,y_2)\). The cost to inspect a road segment is the Euclidean distance between its endpoints, computed as \(\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\). Your task is to determine the maximum number of road segments you can inspect in each test case such that the total cost does not exceed the budget B. To achieve this, you should consider the road segments in increasing order of their individual inspection costs.

Input:

  • The first line contains an integer T, the number of test cases.
  • For each test case, the first line contains two integers N and B, separated by a space.
  • This is followed by N lines, each containing four numbers: x1 y1 x2 y2, describing a road segment.

Output: For each test case, output a single integer on a new line representing the maximum number of road segments that can be inspected.

inputFormat

The input is given via standard input (stdin). The format is as follows:

T
N B
x1 y1 x2 y2
x1 y1 x2 y2
... (N lines for road segments)
... (repeat the above for each test case)

Where:

  • T is the number of test cases.
  • N is the number of road segments in a test case.
  • B is the available budget.
  • x1, y1, x2, y2 are the coordinates of the endpoints of a road segment.

outputFormat

The output should be printed to standard output (stdout). For each test case, print a single line containing an integer representing the maximum number of road segments that can be inspected without exceeding the budget.

## sample
2
3 10
0 0 3 4
0 0 1 1
0 0 6 8
2 5
1 1 4 5
0 0 3 4
2

1

</p>