how to solve noisy neighbour from codejam?

please can anybody give me the approach to solve Noisy Neighbours problem from codejam round 1B?