#C5784. Task Assignment to Minimize Performance Difference
Task Assignment to Minimize Performance Difference
Task Assignment to Minimize Performance Difference
You are given n employees and m tasks. Each task has an associated completion time. Your goal is to assign each task to an employee such that the difference between the maximum total time and the minimum total time assigned among all employees is minimized.
The tasks should be distributed in a way that balances the workload as evenly as possible. In other words, if one employee ends up with a sum of task times that is too high compared to another, the difference should be minimized.
Input/Output: The problem expects input from stdin and outputs the result to stdout.
The answer is an integer representing the minimized difference in total performance, computed as the difference between the employee with the maximum total task time and the one with the minimum total task time.
inputFormat
The first line contains two integers n and m separated by a space, where n is the number of employees, and m is the number of tasks.
The second line contains m integers, where each integer represents the completion time of a task. If m is 0, the second line will be empty.
outputFormat
Output a single integer which is the minimized difference between the maximum and minimum total performance (i.e., total task times) among all employees.
## sample3 7
1 2 3 4 5 6 7
1
</p>