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

建议使用的浏览器:

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

1843:Horizontal and Vertical Rays

题目描述
There are H horizontal rays and V vertical rays. A horizontal ray is a straight line which originates at some point and extends infinitely far to the right (towards increasing X coordinates). A vertical ray is a straight line which originates at some point and extends infinitely far down (towards decreasing Y coordinates). A horizontal ray whose origin is (Xh,Yh) touches a vertical ray whose origin is (Xv,Yv) if Xh<=Xv and Yh<=Yv.
You must choose a subset S consisting of the minimum number of vertical rays such that each horizontal ray is touched by at least one vertical ray in S. It is guaranteed that it will always be possible to choose such a subset for the given test data.
输入解释
The first line of input contains an integer number T, representing the number of test cases to follow. The first line of each test case contains 2 integer numbers: H (1<=H<=100.000) and V (1<=V<=100.000). The next H lines contain 2 integers each: X and Y, representing the (X,Y) coordinates of the origins of the horizontal rays. The next V lines contain 2 integers each: X and Y, representing the (X,Y) coordinates of the origins of the vertical rays. All the X and Y coordinates in the input are in the range 0 ... 50.000.000.
输出解释
For each of the T test cases, in the order given in the input, print one line containing the minimum number of vertical rays chosen.
输入样例
1
3 3
1 6
4 4
6 2
3 8
5 7
9 4
输出样例
2
提示
The solution might consist of the second and third vertical rays. Another solution could be formed by the first and the third vertical rays.
来自杭电HDUOJ的附加信息
Author Mugurel Ionut Andreica
Recommend lcy

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

源链接: HDU-1843

最后修改于 2020-10-25T22:48:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000/5000MS(Java/Others) 65535/65535K(Java/Others)