A delivery robot is an autonomous machine designed to provide delivery services. On many campuses, these robots can offer significant convenience to students.
A delivery robot typically integrates various assistance systems, such as collision avoidance systems. These systems should enable the robot to automatically avoid both static obstacles and other robots. Due to the non-immediate nature of velocity control, collision avoidance systems typically allocate a time interval Δt. If a collision is predicted to occur within Δt at the current velocity, the system adjusts the robot's velocity accordingly, including its speed and direction.
We assume that the velocity can change instantly at the beginning of Δt but remains constant throughout Δt. In this problem, we set Δt=1, meaning you only need to consider the first Δt=1 from the initial position, without considering the subsequent process.
We envision the delivery robot as a moving convex polygon on a two-dimensional plane with n vertices, with its initial vertex coordinates given. In addition, there is a stationary convex polygonal obstacle on the plane with m vertices, and its vertex coordinates are also given.
As a developer of the collision avoidance system, you want to conduct q tests, each time setting an initial velocity vector v for the robot, and the robot will start from the given initial position. According to the principle of the collision avoidance system, if the robot will collide with the obstacle after traveling for Δt=1 at the current velocity, the robot's velocity should be changed immediately at the beginning, that is, v should be modified to v′.
Without an upper limit on speed, it is evident that a suitable v′ must exist to prevent a collision within Δt=1. Depending on the situation, different strategies can be used to select v′. The ob
The first line contains an integer T (1≤T≤20), indicating the number of test cases.
The first line of each test case contains three integers n,m,q (3≤n,m,q≤1000), indicating the number of vertices of the delivery robot and the obstacle, respectively.
Each of the next n lines contains two integers x,y (−106≤x,y≤106), indicating the coordinates of a vertex of the delivery robot. The coordinates are given in counter-clockwise order.
Each of the next m lines contains two integers x,y (−106≤x,y≤106), indicating the coordinates of a vertex of the obstacle. The coordinates are given in counter-clockwise order. It is guaranteed that the delivery robot and the obstacle are strictly disjoint.
Each of the next q lines contains two integers x,y (−106≤x,y≤106), indicating the initial velocity vector v=(x,y) of the delivery robot.
It is guaranteed that ∑n≤2000 and ∑m≤2000 and ∑q≤5000 over all test cases.
For each test, output the square of the minimum magnitude of v−v′, i.e.min∥v−v′∥2, in a single line. You should output the answer as an irreducible fraction p/q, where p, q are integers and q>0.
1
4 3 3
-1 -1
-2 -1
-2 -2
-1 -2
0 1
1 0
2 2
1 1
2 2
3 3
0/1
1/2
18/5