Plane stretching | 프로그래밍의 벗 PivotOJ
PivotOJ

Plane stretching

시간 제한: 10000ms메모리 제한: 1024MB출처: MOOI 2021-22 finalBOJ 30672

문제

Igor is a big fan of geometry, so he bought himself a plane together with a set PP of nn distinct points, ii-th of them is located at (xi,yi)(x_i,y_i).

It was extremely easy for Igor to find two points among them furthest away from each other. He quickly got bored and decided to come up with qq real numbers α1\alpha_1, α2\alpha_2, α3\alpha_3, \ldots, αq\alpha_q. For each of these numbers Igor is interested in the maximum possible distance between any two of the points if he scales the xx-coordinate of each point by αj\alpha_j. Formally speaking, he is interested in finding the two furthest points in a set (xiαj,yi)(x_i \cdot \alpha_j, y_i). Please help Igor!

입력

Each input contains multiple test cases. The first line contains two integers tt and gg (1t2500001 \le t \le 250\,000, 0g90 \le g \le 9) --- the number of test cases and the group number to indicate additional constraints those test cases might satisfy. Then tt test cases follow.

Each test case starts with two integers nn and qq (2n500000,1q500000)(2 \le n \le 500\,000, 1 \le q \le 500\,000) --- the number of points and the number of queries.

The following nn lines contain the coordinates of each point xix_i and yiy_i (109xi,yi109)(-10^9 \le x_i, y_i \le 10^9). It is guaranteed that all points within a test case are distinct.

The following qq lines contain the queries, each of them is identified by a single real number αj\alpha_j (1αj109)(1 \le \alpha_j \le 10^9) --- the scaling coefficients.

Let us denote the sum of values nin_i among all test cases as NN, and the sum of values qiq_i as QQ. It is guaranteed that N,Q500000N, Q \le 500\,000.

출력

For each test case output qq real numbers: the answer to ii-th query. Your answer will be accepted if its absolute or relative error does not exceed 10610^{-6}. More precisely, if aa is your answer, and bb is the judges' answer, then your answer will be considered correct in case abmax(b,1)106\frac{|a-b|}{\max(b,1)} \le 10^{-6}.

예제

예제 1

입력
2 0
5 2
0 0
1 1
0 2
-1 3
0 4
1
2.5
8 4
0 0
6 11
7 13
4 14
0 15
-4 14
-7 13
-6 11
2
1
1.25
1.5
출력
4.000000
5.385165
28.000000
15.000000
17.500000
21.000000
코드를 제출하려면 로그인하세요.