303860: CF744D. Hongcow Draws a Circle

Memory Limit:256 MB Time Limit:6 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hongcow Draws a Circle

题意翻译

给定 $n$ 个红点和 $m$ 个蓝点,保证都是整点且不会有重合。要求找一个半径最大的圆,使得至少包含一个红点,但不包含蓝点(恰在圆上的点可以视为包含也可以视为不包含)。求最大的半径。无穷大输出 $-1$。 $1\leq n,m\leq1000;1\leq x_i,y_i\leq 10000$

题目描述

Hongcow really likes the color red. Hongcow doesn't like the color blue. Hongcow is standing in an infinite field where there are $ n $ red points and $ m $ blue points. Hongcow wants to draw a circle in the field such that this circle contains at least one red point, and no blue points. Points that line exactly on the boundary of the circle can be counted as either inside or outside. Compute the radius of the largest circle that satisfies this condition. If this circle can have arbitrarily large size, print $ -1 $ . Otherwise, your answer will be accepted if it has relative or absolute error at most $ 10^{-4} $ .

输入输出格式

输入格式


The first line of the input will contain two integers $ n,m $ ( $ 1<=n,m<=1,000 $ ). The next $ n $ lines will contain two integers $ x_{i},y_{i} $ ( $ 1<=x_{i},y_{i}<=10^{4} $ ). This denotes the coordinates of a red point. The next $ m $ lines will contain two integers $ x_{i},y_{i} $ ( $ 1<=x_{i},y_{i}<=10^{4} $ ). This denotes the coordinates of a blue point. No two points will have the same coordinates.

输出格式


Print $ -1 $ if the circle can have arbitrary size. Otherwise, print a floating point number representing the largest radius circle that satisfies the conditions. Your answer will be considered correct if its absolute or relative error does not exceed $ 10^{-4} $ . Namely, let's assume that your answer is $ a $ and the answer of the jury is $ b $ . The checker program will consider your answer correct if ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF744D/52c84cb27b50fce8b08f35fa39c1f083ebd1a014.png).

输入输出样例

输入样例 #1

2 5
2 3
3 4
1 1
1 4
4 2
4 7
2 5

输出样例 #1

3.5355338827

输入样例 #2

1 6
3 3
1 5
5 4
2 1
3 4
4 2
1 3

输出样例 #2

1.5811388195

输入样例 #3

2 2
2 2
3 3
1 1
4 4

输出样例 #3

-1

说明

This is a picture of the first sample ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF744D/50e8da306fe47947cfeb784650b3d6b2ea876ead.png)This is a picture of the second sample ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF744D/a1b03125c876722297007ba9fc107d7fb9df9570.png)

Input

题意翻译

给定 $n$ 个红点和 $m$ 个蓝点,保证都是整点且不会有重合。要求找一个半径最大的圆,使得至少包含一个红点,但不包含蓝点(恰在圆上的点可以视为包含也可以视为不包含)。求最大的半径。无穷大输出 $-1$。 $1\leq n,m\leq1000;1\leq x_i,y_i\leq 10000$

加入题单

上一题 下一题 算法标签: