why i am geeting wrong answer

I am solving CBALLS problem of JAN16 CONTEST wrote a code for this problem.But i am geeting wrong answer with this solution

please help.
edit: TLE solved but geeting wrong answer.

Haven’t read the problem yet, but one optimization you can do is to change this:

while(arr[i]>arr[i+1])
{
  arr[i+1]+=1;
  count++;
}

into this:

count += arr[i] - arr[i+1];
arr[i+1] = arr[i];
2 Likes
//