#K69657. Minimum Workers Scheduling
Minimum Workers Scheduling
Minimum Workers Scheduling
You are given a set of tasks, each defined by a start time and an end time. Two tasks overlap if one task starts before the other ends. The objective is to determine the minimum number of workers required to execute all tasks such that no worker is assigned overlapping tasks.
Formally, let there be T tasks. Each task is represented by the interval \([s_i, e_i]\) with start time \(s_i\) and end time \(e_i\). We need to calculate the minimum number of workers required so that at any point in time, the number of tasks running concurrently does not exceed the number of available workers.
inputFormat
The input is provided via standard input (stdin) with the following format:
- The first line contains a single integer n, the number of tasks.
- The next n lines each contain two space-separated integers representing the start time and end time of a task.
For example:
3 1 3 2 5 4 6
outputFormat
Output a single integer to standard output (stdout), the minimum number of workers required to cover all tasks such that no two overlapping tasks are handled by the same worker.
For the sample input above, the output should be:
2## sample
3
1 3
2 5
4 6
2