问题 B: Delivery Robot

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:0

题目描述

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 objective of this problem is to choose a v that minimizes the magnitude of the difference between v and v, i.e. v=argminuvu. The magnitude of a vector v=(x,y) is defined as v=x2+y2.

输入格式

The first line contains an integer T (1T20), indicating the number of test cases.

The first line of each test case contains three integers n,m,q (3n,m,q1000), indicating the number of vertices of the delivery robot and the obstacle, respectively.

Each of the next n lines contains two integers x,y (106x,y106), 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 (106x,y106), 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 (106x,y106), indicating the initial velocity vector v=(x,y) of the delivery robot.

It is guaranteed that n2000 and m2000 and q5000 over all test cases.

输出格式

For each test, output the square of the minimum magnitude of vv, i.e.minvv2, in a single line. You should output the answer as an irreducible fraction p/q, where pq 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

数据范围与提示

You can use __int128 in your C++ code.

分类标签