Finding Hotels
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)
Total Submission(s): 344 Accepted Submission(s): 81
Problem Description
There are N hotels all over the world. Each hotel has a location anda price. M guests want to find a hotel withan acceptable price anda minimum distance from their locations. The distances are measured in Euclidean metric.
Input
The firstline is thenumberof test cases. For each test case, thefirstlinecontainstwo integers N (N ≤ 200000) and M (M ≤ 20000). Each ofthe following N lines describes a hotel with3 integers x (1 ≤ x ≤ N), y (1 ≤ y ≤ N) and c (1 ≤ c ≤ N), in which x and y are the coordinates ofthe hotel, c is its price. It is guaranteed that eachofthe N hotels has distinct x, distinct y, and distinct c. Then eachofthe following M lines describes the query ofa guest with3 integers x (1 ≤ x ≤ N), y (1 ≤ y ≤ N) and c (1 ≤ c ≤ N), in which x and y are the coordinates ofthe guest, c is the maximum acceptable price ofthe guest.
Output
For each guests query, output the hotel that the price is acceptable and is nearest tothe guests location. If there are multiple hotels with acceptable prices and minimum distances, output thefirstone.
Sample Input
23311132323222122222355144212453521335331332333334335
Sample Output
111232323521212212144335
Source
2016ACM/ICPC亚洲区青岛站-重现赛(感谢中国石油大学)
Finding HotelsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 344 Accepted Submission(s): 81Problem DescriptionThere are N hotels all ove