availableServers
and busyServers
.availableServers
with all servers, each represented as a tuple (weight, index)
.tasks
, with the current second t
starting from 0.busyServers
to availableServers
if they have finished their tasks by the current second t
.availableServers
is not empty, assign the current task to the server at the top of availableServers
and move it to busyServers
with the updated available time.availableServers
is empty, take the server at the top of busyServers
, assign the current task to it, and update its available time.t
by 1 after each task assignment.