#P9062. [Ynoi2002] Adaptive Hsearch&Lsearch
[Ynoi2002] Adaptive Hsearch&Lsearch
Problem Description
There are points on a two-dimensional plane.
There are queries. In the -th query, two numbers are given (). You need to find a pair such that , and the Euclidean distance between and is minimized.
Input Format
The first line contains two integers , representing the number of points and the number of queries.
The next lines each contain two integers , representing the coordinates of .
The next lines each contain two integers (), representing the -th query.
Output Format
For each query, output one integer per line, representing the minimum value of .
5 5
2 4
1 1
3 3
5 1
4 2
1 5
2 3
2 4
3 5
1 3
2
8
8
2
2
2 1
1 1
1 1
1 2
0
Hint
Idea: Claris, Solution: Claris, Code: Claris, Data: Claris & nzhtl1477.
For of the testdata, , , .
Translated by ChatGPT 5