Rajib_119's blog

By Rajib_119, history, 7 years ago, In English

Need help in this problem. What is the formula? Thanks in Advance.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it +3 Vote: I do not like it

The problem is simple, It requires to know the concept of median. Well the approach is: We sort all the positions. Then We Can say that the fucka point lies in the range of middle two elements.

Now the probabilty(ans) is : (length of the segment between two mid points)/m
ie after sorting ans is: (a[n/2]-a[(n-1)/2])/m;

The proof is easy to realise by writing the expression for distance and see that median always satisfy the condition.