Problem D
Cookie Cutter

Everyone loves chocolate chip cookies! Which unfortunately means sharing sometimes. In this case, you have generously agreed to split a square chocolate chip cookie with your friend.
Because it is your cookie, you get to choose how to cut the cookie, and which piece to give to your friend. You can split the cookie along any straight line that passes through the cookie; the line need not be axis-aligned.
You know the location of all chocolate chips in the cookie. Because you prefer a cookie that is dense with chocolate chips, you want to optimize your cut to produce the best possible split. You accomplish this by maximizing the difference between the fraction of chocolate chips in your piece and the fraction of cookie area in your piece.
Input
The first line of input contains two space-separated
integers
The next
Output
Output a real number, which is the maximum possible value
for
Sample Input 1 | Sample Output 1 |
---|---|
5 8 1 1 1 2 1 3 2 1 3 1 3 4 4 1 4 2 |
0.375 |