← Home
write a go solution for B. Line Segmentstime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPIKASONIC - Lost My Mind (feat.nakotanmaru) You are given two points (p_x,p_y) and (q_x,q_y) on a Euclidean plane.You start at the starting point (p_x,p_y) and will perform n operations. In the i-th operation, you must choose any point such that the Euclidean distance^∗ between your current position and the point is exactly a_i, and then move to that point.Determine whether it is possible to reach the terminal point (q_x,q_y) after performing all operations.^∗The Euclidean distance between (x_1,y_1) and (x_2,y_2) is sqrt(x_1-x_2)^2+(y_1-y_2)^2InputEach test contains multiple test cases. The first line contains the number of test cases t (1<=t<=10^4). The description of the test cases follows. The first line of each test case contains a single integer n (1<=n<=10^3) — the length of the sequence a.The second line of each test case contains four integers p_x,p_y,q_x,q_y (1<=p_x,p_y,q_x,q_y<=10^7) — the coordinates of the starting point and terminal point.The third line of each test case contains n integers a_1,a_2,ldots,a_n (1<=a_i<=10^4) — the distance to move in each operation.It is guaranteed that the sum of n over all test cases does not exceed 2*10^5.OutputFor each test case, output "Yes" if it is possible to reach the terminal point (q_x,q_y) after all operations; otherwise, output "No".You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.ExampleInput521 1 5 13 331 1 3 32 3 42100 100 100 1004 515 1 1 45210000000 10000000 10000000 1000000010000 10000OutputYes
Yes
No
Yes
Yes
NoteHere is a picture that shows a possible movement of the first test case. The coordinates of point r_1 are (3,1+sqrt5).    The first test case. Here is a picture that shows a possible movement of the second test case. The coordinates of point r_1 are (1+sqrt3,0), and the coordinates of point r_2 are (-frac(sqrt3+4)(3sqrt3(149-24sqrt3)-7sqrt3-38)104,-fracsqrt3(1331-764sqrt3)+12sqrt3-27104).    The second test case. For the third test case, it can be shown that there is no set of moves that satisfies all requirements.Here is a picture that shows a possible movement of the fourth test case.    The fourth test case.. Output only the code with no comments, explanation, or additional text.