Plane stretching

시간 제한10초메모리 제한1024 MB

요약
x좌표에 각 배율 a를 적용한 점 집합의 지름을 각 질의마다 구한다.
난이도

어려움10점 중 8점

유형
기하, 분할 정복, 이분 탐색
정답자
아직 제출이 없습니다

문제

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 (x_i,y_i)(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 (x_i⋅α_j,y_i)(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 (1≤t≤250,0001 \le t \le 250\\,000, 0≤g≤90 \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 (2≤n≤500,000,1≤q≤500,000)(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 x_ix\_i and y_iy\_i (−109≤x_i,y_i≤109)(-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≤α_j≤109)(1 \le \alpha\_j \le 10^9) --- the scaling coefficients.

Let us denote the sum of values n_in\_i among all test cases as NN, and the sum of values q_iq\_i as QQ. It is guaranteed that N,Q≤500,000N, 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 10−610^{-6}. More precisely, if aa is your answer, and bb is the judges' answer, then your answer will be considered correct in case ∣a−b∣max⁡(b,1)≤10−6\frac{|a-b|}{\max(b,1)} \le 10^{-6}.

예제1

  1. 예제 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