#P6230. Find the C-th Best Team
Find the C-th Best Team
Find the C-th Best Team
In this problem, two neighboring cities send a team of exactly contestants to participate in competitions every year. Each contestant takes part in all competitions. For each competition, the team’s score is determined by the highest score obtained by any team member in that competition. The total team score is the sum of the scores from all competitions.
A team is formed by selecting exactly candidates out of available candidates. Two teams are considered different if and only if they differ in at least one member. The teams are then ranked in descending order according to their total scores (the team with the highest score is ranked 1, the second highest is ranked 2, and so on). Your task is to find the total score of the -th best team.
The input begins with three integers , , and , where is the number of candidates, is both the number of competitions and the team size, and represents the rank of the team to retrieve (with being the best team). Each of the following lines contains integers, with the -th integer in the -th line representing the score of candidate in competition .
inputFormat
The first line contains three integers: (the number of candidates), (the number of competitions and the number of contestants in each team), and (the rank of the team to find, where is the best team).
Each of the next lines contains integers, where the -th integer is the score for that candidate in competition .
outputFormat
Output a single integer representing the total score of the -th best team.
sample
3 3 1
4 5 3
7 3 6
3 4 5
18