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

建议使用的浏览器:

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

5107:K-short Problem

题目描述
In the view of a satellite, you can see lots of tall buildings in the city, and we assume that the city's border is flat. Now you have observed n tall buildings in the city and recorded their position and height. Due to some mysterious reasons, you need to answer a series of queries. Each query will give you a position(x, y) and k, then you have to find out the k-th shortest building in set{$(x, y) | x \leq X, y \leq Y$}.
输入解释
Multiple test cases.For each test case, the first line will contain two integers n and m($0 < n \leq 30000, 0 \leq m \leq 30000$), which represents the amount of buildings and amount of queries. Then n lines follow, contains three integers $x, y, h (-1E9 \leq x, y \leq 1E9, 0 \leq h \leq 1E9)$ indicate the building's position and height in each line. Then there are m lines, each with three integers $x, y, k (-1E9 \leq x, y \leq 1E9, 1 \leq k \leq 10)$ used for query.
输出解释
For each test case, if the k-th shortest building exists, output its height in 1 line, otherwise print "-1" (without quotes).
输入样例
5 2
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
0 0 1
6 3 2
输出样例
-1
2
来自杭电HDUOJ的附加信息
Recommend heyang

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

题目来源 BestCoder Round #18

源链接: HDU-5107

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

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 32768/32768K(Java/Others)