Hey I was recently giving a coding test for a company and this question appeared.
You are given points (0,0) (N,0) (0,M) and (N,M) that form a rectangle. You have a point (x,y) that is within a rectangle or on one of its edges. Now a straight line is drawn passing through (x,y) to cut the rectangle into 2 parts. Find the max possible area of the part whose area is not larger than the other. Also determine if there are multiple ways to cut the rectangle and achieve the maximum.
Input: N M X Y
1<= N,M<= 1E9
Output: Print the max possible area followed by 1 if there are multiple ways to cut the rectangle and achieve maximum else print 0
2 3 1 2
the line x=1 gives the optimal cut with no other posibilties.
2 4 1 2