#C11285. Maximum Points Assignment
Maximum Points Assignment
Maximum Points Assignment
You are given a number V representing the number of volunteers and a list of tasks with associated points. Each volunteer can perform at most one task. Your goal is to maximize the total points by assigning the highest-point tasks to available volunteers. Formally, if you have n tasks with points \(t_1, t_2, \ldots, t_n\) and V volunteers, the maximum points is given by:
$$\text{max\_points} = \sum_{i=1}^{\min(V, n)} t_i$$
Here, the tasks are sorted in descending order to select the top tasks.
inputFormat
The input is given via stdin in the following format:
- The first line contains an integer V, the number of volunteers.
- The second line contains an integer N, the number of tasks.
- The third line contains N space-separated integers representing the points for each task.
outputFormat
Output a single integer on stdout which represents the maximum points that can be earned by optimally assigning tasks to the volunteers.
## sample3
6
4 5 1 3 7 2
16
</p>