Given server weights and task durations arriving one per second, assign each task to the available server with the smallest weight, breaking ties by server index. Return the assigned server index for each task.
servers = server weights, tasks = task durations
server index chosen for each task in arrival order
Example 1:
Input:
servers = [3,3,2] tasks = [1,2,3,2,1,2]
Output:
[2,2,0,2,1,2]
Explanation:
This is the standard example: the lightest server is chosen whenever available.
Example 2:
Input:
servers = [5,1,4,3,2] tasks = [2,1,2,4,5,2,1]
Output:
[1,4,1,4,1,3,2]
Explanation:
Servers are chosen by weight first, then by index.