#K69992. Squared Euclidean Distance Check
Squared Euclidean Distance Check
Squared Euclidean Distance Check
You are given T test cases. In each test case, you are provided with a set of n points on a 2D plane and an integer k. Your task is to check if there exists a pair of distinct points such that their squared Euclidean distance is exactly (k^2). The squared Euclidean distance between two points ((x_1, y_1)) and ((x_2, y_2)) is defined as ((x_2 - x_1)^2 + (y_2 - y_1)^2). If at least one such pair exists, print yes
; otherwise, print no
.
For example, if the points are ((0, 0)), ((3, 4)), and ((6, 8)) and (k = 5), since (3^2 + 4^2 = 25 = 5^2), the answer is yes
.
inputFormat
The first line contains an integer T, the number of test cases. For each test case, the first line contains an integer n, denoting the number of points. The next n lines each contain two integers representing the x and y coordinates of a point. The last line of each test case contains an integer k.
outputFormat
For each test case, output a single line containing yes
if there exists a pair of points whose squared Euclidean distance equals (k^2); otherwise, output no
.## sample
3
3
0 0
3 4
6 8
5
4
1 2
3 1
6 5
7 8
10
4
0 0
0 3
0 4
3 0
3
yes
no
yes
</p>