#K78402. Minimum Completion Time Difference

    ID: 35078 Type: Default 1000ms 256MiB

Minimum Completion Time Difference

Minimum Completion Time Difference

Given a list of task counts representing the number of tasks assigned to each worker, your task is to find the minimum difference between the completion times of any two workers. The completion time of a worker is directly proportional to the number of tasks assigned. First, sort the list in non-decreasing order. Then, the minimum difference is computed as

$$\min_{0\le i < n-1} (tasks[i+1] - tasks[i])$$

If there are fewer than two workers, output 0.

inputFormat

The input is read from standard input (stdin) and consists of:

  • The first line contains an integer n, the number of workers.
  • If n > 0, the second line contains n space-separated integers representing the tasks assigned to each worker.

outputFormat

Output a single integer to standard output (stdout), which is the minimum difference between the completion times of any two workers. If the list is empty or contains only one worker, output 0.

## sample
0
0

</p>