spoj BALIFE - Load Balancing

How to approach and solve this problem?

Link

refer here for AC solution

the problem statement is not clear…please read comments below the problem for further understanding.

I am not asking for the AC solution, I have got the AC solutions online, instead I wanted the approach and explanation of the solution for this questions, there are many sites which provide AC solution, I have seen. It will be very much helpful if anyone can explain how to solve this question.

//