aggrcow on spoj

I know that binary search will be used to solve this question but I can’t figure out the exact solution. Can somebody help. Link to the problem :

Yes Binary search is the answer.
lets see.
let l=1,h=1e16(low and high). MID=(l+h)>>1; Now ques is what does this mid represents .
mid represents whether is it possible to arrange the cows such that min distance between consecutive cows is =mid. if this is possible we start looking at a better solution than this. Now what would be better solution than this .? It would be (if it exist ) in the range of [mid high] . if it isn’t possible then answer would be in the range [low,mid-1]