Minimize the finish time of tasks that take one hour for a specialist and two hours for other workers. Derive a capacity feasibility test, prove it, and binary-search the earliest achievable completion time.
There are n workers and m tasks. Each task has one designated proficient worker. That worker takes one hour to perform it; any other worker takes two hours. Workers operate in parallel but each handles only one task at a time. Assign all tasks to minimize the time when every task is complete, starting at time zero.
### Constraints and Clarifications
The report identifies Codeforces 1701C, [Schedule Management](https://codeforces.com/problemset/problem/1701/C), and says the interview limits were much larger than the reference limits. Their exact values are not supplied, so do not assume the reference maximum applies. Use n>=1, m>=1 and valid worker IDs from 1 through n. Return the minimum integer completion time for one instance; no assignment witness is required. Use integer counts capable of representing the actual input size.
### Example
With two workers and four tasks all assigned proficiently to worker 1, the minimum time is 3. Worker 1 performs three tasks while worker 2 performs one in two hours.
### What a Strong Answer Covers
Aggregate tasks per proficient worker, derive a feasibility test for a candidate finishing time, prove its sufficiency and necessity, and use monotonicity to find the minimum efficiently.
### Follow-up Questions
- Why is the spare capacity for unfamiliar tasks divided by two and rounded down?
- Why can task identities be discarded after counting their proficient workers?
Overview: Minimize the finish time of tasks that take one hour for a specialist and two hours for other workers. Derive a capacity feasibility test, prove it, and binary-search the earliest achievable completion time.
There are n workers and m tasks. Each task has one designated proficient worker. That worker takes one hour to perform it; any other worker takes two hours. Workers operate in parallel but each handles only one task at a time. Assign all tasks to minimize the time when every task is complete, starting at time zero.
Constraints and Clarifications
The report identifies Codeforces 1701C, Schedule Management, and says the interview limits were much larger than the reference limits. Their exact values are not supplied, so do not assume the reference maximum applies. Use n>=1, m>=1 and valid worker IDs from 1 through n. Return the minimum integer completion time for one instance; no assignment witness is required. Use integer counts capable of representing the actual input size.
Example
With two workers and four tasks all assigned proficiently to worker 1, the minimum time is 3. Worker 1 performs three tasks while worker 2 performs one in two hours.
What a Strong Answer Covers Guidance
Aggregate tasks per proficient worker, derive a feasibility test for a candidate finishing time, prove its sufficiency and necessity, and use monotonicity to find the minimum efficiently.
Follow-up Questions Guidance
Why is the spare capacity for unfamiliar tasks divided by two and rounded down?
Why can task identities be discarded after counting their proficient workers?