World's Richest(25 分)"/>
1055 The World's Richest(25 分)
1055 The World’s Richest(25 分)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the people in a certain range of ages. That is, given the net worths of N people, you must find the M richest people in a given range of their ages.
Input Specification:
Each input file contains one test case. For each case, the first line contains 2 positive integers: N (≤10
5
) - the total number of people, and K (≤10
3
) - the number of queries. Then N lines follow, each contains the name (string of no more than 8 characters without space), age (integer in (0, 200]), and the net worth (integer in [−10
6
,10
6
]) of a person. Finally there are K lines of queries, each contains three positive integers: M (≤100) - the maximum number of output
更多推荐
1055 The World's Richest(25 分)
发布评论