Load balancer code problem-greedy algorithm part


I am getting error of TLE can you explain why

@Nitishbhalla
Increase your array size as its mentioned N <= 9000.
A general tip while submitting solutions on SPOJ -
SPOJ uses extremely well built testcases. Always use fast input output to solve problems over it or you might get a TLE even with the perfect algorithm.
For fast IO , just copy-paste this statement at the beginning of your main () .

ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);