#P13545. [OOI 2022] Plane stretching

[OOI 2022] Plane stretching

题目描述

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\textbf{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}.

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

提示

Scoring

The testset for this problem consists of 9 test groups. You get points for a group only if your solution passes all tests from this group and from all the required groups. Offline-evaluation\textbf{Offline-evaluation} means that you will not get immediate feedback for this group and you will be able to see the outcome only after the end of the competition.

Random points means that each coordinate is chosen uniformly and independently between 109-10^9 and 10910^9.

Group Points Additional constraints < Required groups Comment
nin_i NN qiq_i QQ
0 -- Sample test cases
1 12 ni10n_i \le 10 N2000N \le 2000 qi10q_i \le 10 Q2000Q \le 2000 0
2 9 ni2000n_i \le 2000 qi2000q_i \le 2000 0 -- 1
3 13 ni5000n_i \le 5000 N5000N \le 5000 qi10000q_i \le 10\,000 Q10000Q \le 10\,000 0 -- 2
4 11 ni100000n_i \le 100\,000 N100000N \le 100\,000 qi100000q_i \le 100\,000 Q100000Q \le 100\,000 -- Random points
5 8 -- 4
6 12 ni5000n_i \le 5000 N5000N \le 5000 qi100000q_i \le 100\,000 Q100000Q \le 100\,000 0 -- 3
7 11 -- 0 -- 3, 6
8 10 ni100000n_i \le 100\,000 N100000N \le 100\,000 qi100000q_i \le 100\,000 Q100000Q \le 100\,000 0 -- 4, 6
9 14 -- 0 -- 8 Offline-evaluation