Company: Ethos_life_25dec
Difficulty: medium
Load Distribution Problem Description A web application is served by k identical servers, numbered 1 through k . Requests arrive over the course of a day; request i arrives at time arrival[i] and needs load[i] units of processing time. A server that starts a request at time t is busy for the whole interval and becomes free again at time t + load , so a server whose finish time is exactly the arrival time of the next request is free for that request. Requests are handled in order of arrival time. Counting from 0 , the request that is p -th in arrival order is offered first to server (p mod k) + 1 ; if that server is busy, server (p mod k) + 2 is tried, and so on, wrapping round from server k back to server 1 . The first free server found takes the request. If every server is busy, the request is dropped and adds nothing to anyone's total. At the end of the day, report the servers that did the most work, measured by the sum of the loads they processed. If several servers tie, report