当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5484:Monitor the Alpacas

题目描述
Coach Zhang has an infinite ranch with N alpacas on it. The alpacas are so lazy that they never move. The $i$-th ($1≤i≤N$) alpaca is located at the point ($X_i,Y_i$).
Coach Zhang wants to monitor all the alpacas. He found $M$ points where cameras can be placed in his ranch. Coach Zhang only needs to place one camera at a point if he thinks it necessary. An alpaca is monitored when it is on one of the cameras, on the segment between two cameras, or in the triangle formed by three cameras.
Now Coach Zhang wants to know the minimum number of cameras required to monitor all the alpacas.
输入解释
The first line of input contains an integer $T$, which represents the number of test cases ($T≤20$).
Each test case starts with a line containing $N$ and $M$ ($1≤N≤100000,1≤M≤500$).
Each of the next N+M lines contains two integers $X$ and $Y$ ($|X|,|Y|≤10^9$). The first $N$ lines represent the alpacas’ positions and the last $M$ lines indicate the points that cameras can be placed.
输出解释
For each test case, output a single line consisting of “Case #X: Y”. $X$ is the test case number starting from 1. $Y$ is the minimum number of cameras required to monitor all the alpacas. If it is impossible to monitor all the alpacas, you should output -1 instead.
输入样例
3
1 1
0 0
0 0
4 4
0 0
1 0
0 1
-1 0
0 1
1 0
0 -1
-1 0
1 1
0 0
0 1
输出样例
Case #1: 1
Case #2: 3
Case #3: -1
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5484

最后修改于 2020-10-25T23:23:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
17000/8500MS(Java/Others) 65536/65536K(Java/Others)