TLE in CSUMD

please anyone explain me why am i getting tle in this code, i applied algorithm as given in editorial even then i got tle … please help!! http://www.codechef.com/viewsolution/3948251

//