Problem:


Score : 300 points

Problem Statement

There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).
You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.

Constraints

1 \leq W,H \leq 10^9

0\leq x\leq W

0\leq y\leq H

All values in input are integers.

Input

Input is given from Standard Input in the following format:

W H x y

Output

Print the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.

The area printed will be judged correct when its absolute or relative error is at most 10^{-9}.

Sample Input 1

2 3 1 2

Sample Output 1

3.000000 0

The line x=1 gives the optimal cut, and no other line does.

Sample Input 2

2 2 1 1

Sample Output 2

2.000000 1



Sample input:
2 3 1 2


Sample output:
3.000000 0

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(w-2*x)==0 and int(h-2*y)==0:
  print(w*h/2.0, 1)
  exit()
elif int(w-2*x)==0 or int(h-2*y)==0:
  print(w*h/2.0, 0)
  exit()

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5, 0)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if int(d1-d2) == 0:
    casenum = 1
  else:
    casenum = 0
    
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, casenum)
    else:
      print(h*x*h/(h-y)*0.5, casenum)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5, casenum)
    else:
      print((w-b)*h*0.5, casenum)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(w-2*x)==0 and int(h-2*y)==0:
  print(w*h/2.0, 1)
  exit()
elif int(w-2*x)==0 or int(h-2*y)==0:
  print(w*h/2.0, 0)
  exit()

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, 0)
    else:
      print(h*x*h/(h-y)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5)
    else:
      print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if (w == h and (int(w-2*x)==0 or int(h-2*y)==0)) or int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, 0)
    else:
      print(h*x*h/(h-y)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5)
    else:
      print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if (w == h and (int(w-2*x)==0 or int(h-2*y))) or int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, 0)
    else:
      print(h*x*h/(h-y)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5)
    else:
      print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 or int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if int(d1-d2) == 0:
    casenum = 1
  else:
    casenum = 0
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, casenum)
    else:
      print(h*x*h/(h-y)*0.5, casenum)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5, casenum)
    else:
      print((w-b)*h*0.5, casenum)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if int(d1-d2) == 0:
    casenum = 1
  else:
    casenum = 0
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, casenum)
    else:
      print(h*x*h/(h-y)*0.5, casenum)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5, casenum)
    else:
      print((w-b)*h*0.5, casenum)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    if  y > h/w*x:
      print(w*(-(y-h)*w/x)*0.5, 0)
    else:
      print(h*x*h/(h-y)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > h/w*x:
      print(h*(w-(b-h)*x/(y-h))*0.5)
    else:
      print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5)
    else:
      print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    print(w*(-(y-h)*w/x)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split(' '))
if x == int(W/2) and y == int(H/2):
  print((W*H/2),1,sep=' ')
else:
  print((W*H/2),0,sep=' ')

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  #test
  print(-1)
  if x > 0.5*w:
    print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    print(w*(-(y-h)*w/x)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d1 = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d2 = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d1 < d2:
  if x > 0.5*w:
    print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    print(w*(h-b)*0.5, 0)
else:
  if x > 0.5*w:
    print(w*(-(y-h)*w/x)*0.5, 0)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    print((w-b)*h*0.5, 0)

Submission status: Wrong Answer

Solution code:
def main():
    W, H, x, y = map(int, input().split())
    cand1 = min((W-x)*H, x*H)
    cand2 = min((H-y)*W, y*W)

    if cand1 == cand2:
        return cand1, 1
    elif W == 2*x and cand2 > cand1:
        return cand2, 1
    elif H == 2*y and cand1 > cand2:
        return cand1, 1
    else:
        return max(cand1, cand2), 0

if __name__ == '__main__':
    # print(main())
    output = main()
    print(' '.join(map(str, output)))

Submission status: Wrong Answer

Solution code:
def main():
    W, H, x, y = map(int, input().split())
    cand1 = min((W-x)*H, x*H)
    cand2 = min((H-y)*W, y*W)
    if cand1 == cand2:
        return cand1, 1
    else:
        return max(cand1, cand2), 0

if __name__ == '__main__':
    # print(main())
    output = main()
    print(' '.join(map(str, output)))

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())

rect_x = [x * h, (w - x) * h]
rect_y = [w * y, w * (h - y)]
rect_x_min = min(rect_x)
rect_y_min = min(rect_y)
ans = max(rect_x_min, rect_y_min)

if rect_x_min == rect_y_min and not (rect_x_min == 0 or rect_y_min == 0):
    flg = "1"
else:
    flg = "0"

print(ans, flg)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())

rect_x = [x * h, (w - x) * h]
rect_y = [w * y, w * (h - y)]
rect_x_min = min(rect_x)
rect_y_min = min(rect_y)
ans = max(rect_x_min, rect_y_min)

if rect_x_min == rect_y_min:
    flg = "1"
else:
    flg = "0"

print(ans, flg)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int,input().split())


"""考え方
下記の時のみ「最大の面積は全体の半分」、かつ「パターンが１つ」のみに決まる。
もし下記の両条件を満たしているときは「パターンは2つ」となる。

W/2 == x,
H/2 == y


それ以外の場合は「パターンは複数」となる。
また、最大の面積は、必ず全体の半分となる。


以上から、下記の事柄が導かれる。
・求める面積は、必ず全体面積の半分
・W/2==x,H/2==yの「どちらか１つだけ」の条件を満たしている場合は、パターンは1つ。それ以外の時は複数パターン存在する。
"""

area = (W*H) / 2.0

ck1 = False
if W/2 == x:
  ck1 = True

ck2 = False
if H/2 == y:
  ck2 = True

if ck1 ^ ck2:
  print(str(area)+ ' ' + '0')
else:
  print(str(area)+ ' ' + '1')

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
ans = 0

if x*h <= (w-x)*h:
    if w*y <= w*(h-y):
        if x*h == w*y:
            ans = 1
        max_area = max(x*h, w*y)
    else:
        if x*h == w*(h-y):
            ans = 1
        max_area = max(x*h, w*(h-y))
else:
    if w*y <= w*(h-y):
        if (w-x)*h == w*y:
            ans = 1
        max_area = max((w-x)*h, w*y)
    else:
        if (w-x)*h == w*(h-y):
            ans = 1
        max_area = max((w-x)*h, w*(h-y))

if w == h and (x == y or (y == 0 and x == w) or (x == 0 and y == h)):
    max_area = w * h / 2
    if w % 2 != 0:
        ans = 0

print(max_area, ans)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
ans = 0

if x*h <= (w-x)*h:
    if w*y <= w*(h-y):
        if x*h == w*y:
            ans = 1
        max_area = max(x*h, w*y)
    else:
        if x*h == w*(h-y):
            ans = 1
        max_area = max(x*h, w*(h-y))
else:
    if w*y <= w*(h-y):
        if (w-x)*h == w*y:
            ans = 1
        max_area = max((w-x)*h, w*y)
    else:
        if (w-x)*h == w*(h-y):
            ans = 1
        max_area = max((w-x)*h, w*(h-y))

if w == h and x == y:
    max_area = w * h / 2
    if w % 2 != 0:
        ans = 0

print(max_area, ans)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
ans = 0

if x*h <= (w-x)*h:
    if w*y <= w*(h-y):
        if x*h == w*y:
            ans = 1
        max_area = max(x*h, w*y)
    else:
        if x*h == w*(h-y):
            ans = 1
        max_area = max(x*h, w*(h-y))
else:
    if w*y <= w*(h-y):
        if (w-x)*h == w*y:
            ans = 1
        max_area = max((w-x)*h, w*y)
    else:
        if (w-x)*h == w*(h-y):
            ans = 1
        max_area = max((w-x)*h, w*(h-y))

if w == h and x == y:
    max_area = w * h / 2
    if w % 2 != 0:
        ans = 0

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
ans = 0

if x*h <= (w-x)*h:
    if w*y <= w*(h-y):
        if x*h == w*y:
            ans = 1
        max_area = max(x*h, w*y)
    else:
        if x*h == w*(h-y):
            ans = 1
        max_area = max(x*h, w*(h-y))
else:
    if w*y <= w*(h-y):
        if (w-x)*h == w*y:
            ans = 1
        max_area = max((w-x)*h, w*y)
    else:
        if (w-x)*h == w*(h-y):
            ans = 1
        max_area = max((w-x)*h, w*(h-y))

if w == h and x == y:
    max_area = w * h / 2

print(max_area, ans)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
ans = 0

if x*h <= (w-x)*h:
    if w*y <= w*(h-y):
        if x*h == w*y:
            ans = 1
        max_area = max(x*h, w*y)
    else:
        if x*h == w*(h-y):
            ans = 1
        max_area = max(x*h, w*(h-y))
else:
    if w*y <= w*(h-y):
        if (w-x)*h == w*y:
            ans = 1
        max_area = max((w-x)*h, w*y)
    else:
        if (w-x)*h == w*(h-y):
            ans = 1
        max_area = max((w-x)*h, w*(h-y))

print(max_area, ans)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())
ans = 0

#縦に分割するとき
s1 = (W-x)*H
s2 = W*H-s1
tate = min(s1,s2)
#横に分割するとき
s3 = (H-y)*W
s4 = W*H-s3
yoko = min(s3,s4)

if yoko == tate:
    ans = 1

print(max(yoko,tate),ans)

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(int, input().split()))
ans = 0
if x == W/2 and y == H//2:
    ans = 1
print(W*H/2, ans)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())

#1.長方形の周上
if x==0 or x==W or y==0 or y==H:
    print(W*H/2,0)

#2.長方形の中心線上
cnt = 0
if x==W//2:
    cnt += 1
if y==H//2:
    cnt += 1
if cnt==2:
    print(W*H/2,1)
if cnt==1:
    print(W*H/2,0)

#3.それ以外の場合
if cnt==0:
    print(W*H/2,0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())

if W // 2 == x and H // 2 == y:
    print(str(float(W*H)/2) + ' 1')
else:
    print(str(float(W*H)/2) + ' 0')

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())

# Y軸で分割場合(x座標で分割)
y_area_min = x * H if x * H <= (W - x) * H else (W - x) * H

# X軸で分割した場合(y座標で分割)
x_area_min = y * W if y * W <= (H - y) * W else (H - y) * W

if y_area_min == 0 and x_area_min == 0:
    print(str(W * H) + ' 1')
elif y_area_min == x_area_min:
    print(str(x_area_min) + ' 1')
else:
    print(
        str(y_area_min) + ' 0' if y_area_min > x_area_min else str(x_area_min) + ' 0')

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())

# Y軸で分割場合(x座標で分割)
y_area_min = x * H if x * H <= (W - x) * H else (W - x) * H

# X軸で分割した場合(y座標で分割)
x_area_min = y * W if y * W <= (H - y) * W else (H - y) * W

if y_area_min == x_area_min:
    print(str(x_area_min) + ' 1')
else:
    print(str(y_area_min) + ' 0' if y_area_min > x_area_min else str(x_area_min) + ' 0')

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int, input().split())

area1 = min(h*x, h*(w-x))
area2 = min(w*y, w*(h-y))

result = area1
temp = 0
if area1 < area2:
  result = area2
if area1 == area2:
  temp = 1
print(result,temp)

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(int, input().split()))

print(W * H / 2, end=' ')

if x == W // 2 and y == H // 2:
  print('1')
else:
  print('0')

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(lambda x: int(x), input().split())

def is_eq(x, y):
    if abs(x-y) < 1e-9:
        return True
    else:
        return False

if is_eq(w, x) and is_eq(h, y):
    print("{} 1".format(w*h/2))
else:
    print("{} 0".format(w*h/2))

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split(" "))

if (x == W//2) and (y == H//2):
    print(W*H/2.0000,1)
else:
    print(W*H/2.0000,0)

Submission status: Wrong Answer

Solution code:

w, h, x, y = map(int, input().split())

# 点を中心とした４象限の面積を求める
q1 = (w-x) * y
q2 = x * h
q3 = x * (h-y)
q4 = (w-x)*(h-y)

q = [q1, q2, q3, q4]

ans = max(q)
count = q.count(ans)
exists = '1' if count > 1 else '0'

print(ans, exists)

Submission status: Wrong Answer

Solution code:
w, h, x, y = (int(i) for i in input().split())
div_pattern = 0
area = 0
if (w - x) == x and (h - y) == y:
    div_pattern = 1
    area = h * x
else:
    if abs((w/2) - x) < abs((h/2) - y):
        area = h * x
    else:
        area = y * w
print(float(area),div_pattern)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if (2*x == W) and (2*y == H):
  center = 1
else:
  center = 0
print('{:.6f}'.format(W*H//2), center)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if 2*x == W and 2*y == H:
  center = 1
else:
  center = 0
print('{:.6f}'.format(W*H//2), center)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
print(w * h / 2, 1 if (x == w // 2) and (y == h // 2) else 0)

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())

if x <=W//2 and y <=H//2:
    if H*x == W*y:
        print('{:f}'.format(H*x),"1")
    else:
        print('{:f}'.format(max(H*x,W*y),"0"))
elif x<=W//2 and y >H//2:
    if H*x ==W*(H-y):
        print('{:f}'.format(H * x), "1")
    else:
        print('{:f}'.format(max(H * x,W*(H-y))), "0")
elif x>W//2 and y<=H//2:
    if H*(W-x)==W*y:
        print('{:f}'.format(W*y),"1")
    else:
        print('{:f}'.format(max(H*(W-x),W*y),"0"))
else:
    if H*(W-x)==W*(H-y):
        print('{:f}'.format(H*(W-x)),"1")
    else:
        print('{:f}'.format(max(H*(W-x),W*(H-y))),"0")

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())

if x <=W//2 and y <=H//2:
    if H*x == W*y:
        print('{:f}'.format(H*x),"1")
    else:
        print('{:f}'.format(H*x),"0")
elif x<=W//2 and y >H//2:
    if H*x ==W*(H-y):
        print('{:f}'.format(H * x), "1")
    else:
        print('{:f}'.format(H * x), "0")
elif x>W//2 and y<=H//2:
    if H*(W-x)==W*y:
        print('{:f}'.format(W*y),"1")
    else:
        print('{:f}'.format(W*y),"0")
else:
    if H*(W-x)==W*(H-y):
        print('{:f}'.format(H*(W-x)),"1")
    else:
        print('{:f}'.format(H*(W-x)),"0")

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())

if x <=W//2 and y <=H//2:
    if H*x == W*y:
        print(H*x,"1")
    else:
        print(H*x,"0")
elif x<=W//2 and y >H//2:
    if H*x ==W*(H-y):
        print(H * x, "1")
    else:
        print(H * x, "0")
elif x>W//2 and y<=H//2:
    if H*(W-x)==W*y:
        print(W*y,"1")
    else:
        print(W*y,"0")
else:
    if H*(W-x)==W*(H-y):
        print(H*(W-x),"1")
    else:
        print(H*(W-x),"0")

Submission status: Wrong Answer

Solution code:
import fractions

w, h, x, y = list(map(int, input().split()))

res1 = w * h / 2

res2 = 0
if x == w // 2 and y == h // 2:
    res2 = 1

print(str(res1) + ' ' + str(res2))

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int,input().split())
area=w*h/2
awee=0
if x==w/2 or y==h/2:
    awee=0
    if x==w/2 and y==h/2:
        awee=1
else:
    awee=1

print(str(area)+" "+str(awee))

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
m = []

if x <= w-x:
    m.append(x*h)
else:
    m.append((w-x)*h)

if y <= h-y:
    m.append(y*w)
else:
    m.append((h-y)*w)

if m[0] == m[1]:
    print(max(m))
    print(1)
else:
    print(max(m))
    print(0)

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int,input().split())

if w//2 == x and h//2 == y:
	print(w*h/2, 1)
else:
	print(w*h/2, 0)

Submission status: Wrong Answer

Solution code:
#27 ABC130C
w,h,x,y=map(int,input().split())
res=max(min(x*h,(w-x)*h),min(w*y,w*(h-y)))
j=(min(x*h,(w-x)*h)==min(w*y,w*(h-y)))
if j:
	print(res,1)
else:
	print(res,0)

Submission status: Wrong Answer

Solution code:
#27 ABC130C
w,h,x,y=map(int,input().split())
res=max(min(x*h,(w-x)*h),min(w*y,w*(h-y)))
j=(x==(w-x) or y==(h-y) or min(x*h,(w-x)*h)==min(w*y,w*(h-y)))
if j:
	print(res,1)
else:
	print(res,0)

Submission status: Wrong Answer

Solution code:
#27 ABC130C
w,h,x,y=map(int,input().split())
res=max(min(x*h,(w-x)*h),min(w*y,w*(h-y)))
j=(x==(w-x) or y==(h-y))
if j:
	print(res,1)
else:
	print(res,0)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())

M = W*H/2
if 2*x == H and 2*y == W:
    print(M,1)
else:
    print(M,0)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())

M = max(min(x*H,(W-x)*H),min(W*y,W*(H-y)))
if min(x*H,(W-x)*H) == min(W*y,W*(H-y)):
    print(M,1)
else:
    print(M,0)

Submission status: Wrong Answer

Solution code:
w,h,x,y= map(int, input().split())

d=w*h/2
k = 1
if x == w/2 or y == h/2:
    k = 0
if x == w/2 and y == h/2:
    k = 1
print(d, k)

Submission status: Wrong Answer

Solution code:
w,h,x,y= map(int, input().split())

d=w*h/2
k = 1
if x == w/2 or y == h/2:
    k = 0

print(d, k)

Submission status: Wrong Answer

Solution code:
def rectangle_cutting(w,h,x,y):
    s = w * h

    s14 = (w - x) * h
    s23 = x * h

    s12 = w * (h - y)
    s34 = w * y

    sh = min([s14,s23])
    sw = min([s12,s34])

    if sh == sw:
        return sh,1
    elif sh > sw:
        return sh,0
    elif sh < sw:
        return sw,0

if __name__ == '__main__':
    w,h,x,y = map(int,input().split())
    sw,way = rectangle_cutting(w,h,x,y)
    print("%d %d" %(sw,way))

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
m1,m2,m3,m4=0,0,0,0

m1=(w-x)*h
m2=x*h
m3=w*(h-y)
m4=w*y
an=0

if min(m1,m2)==min(m3,m4):
    an=1

print(max(min(m1,m2),min(m3,m4)),an)

Submission status: Wrong Answer

Solution code:
W, H ,x, y = map(int, input().split())
if x == W/2 and y == H/2:
    print(W*H/2, 1)
elif x == 0 or x == W or y == 0 or y == H:
    print(W*H/2, 0)
elif x == W/2 or y ==H/2:
    print(W*H/2, 0)
else:
    P = min(x, W-x)
    Q = min(y, H-y)
    A = P*H
    B = Q* W
    if A == B:
        print(A, 1)
    else:
        print(max(A, B), 0)

Submission status: Wrong Answer

Solution code:
W, H ,x, y = map(int, input().split())
if x == W/2 and y == H/2:
    print(W*H/2, 1)
elif x == 0 or x == W or y == 0 or y == H:
    print(W*H/2, 0)
elif x == W/2 or y ==H/2:
    print(W*H/2, 0)
else:
    P = min(x, W-x)
    Q = min(y, H-y)
    A = P*H
    B = Q* W
    if W == H and (x == y or y == -x + W):
        print(max(A, B), 1)
    else:
        print(max(A, B), 0)

Submission status: Wrong Answer

Solution code:
W, H ,x, y = map(int, input().split())
if x == W/2 and y == H/2:
    print(W*H/2, 1)
elif x == W/2 or y ==H/2:
    print(W*H/2, 0)
else:
    P = min(x, W-x)
    Q = min(y, H-y)
    A = P*H
    B = Q* W
    if W == H and (x == y or y == -x + W):
        print(max(A, B), 1)
    else:
        print(max(A, B), 0)

Submission status: Wrong Answer

Solution code:
W, H ,x, y = map(int, input().split())
if x == W/2 and y == H/2:
    print(W*H/2, 1)
elif x == W/2 or y ==H/2:
    print(W*H/2, 0)
else:
    P = min(x, W-x)
    Q = min(y, H-y)
    A = P*H
    B = Q* W
    print(max(A, B), 0)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
Wmim = 0
Hmin = 0
judge = 0

if x == W and y == H:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif x == W and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()	
elif x == 0 and y == H:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif x == 0 and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()

Wmin = min(W * y, W * (H - y))
Hmin = min(x * H, (W - x) * H)
Amax = max(Wmin, Hmin)

if Wmin == Hmin:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
Wmim = 0
Hmin = 0
judge = 0

if x == W and y == H:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif x == W and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()	
elif x == 0 and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif x == 0 and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()

Wmin = min(W * y, W * (H - y))
Hmin = min(x * H, (W - x) * H)
Amax = max(Wmin, Hmin)

if Wmin == Hmin:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
Wmim = 0
Hmin = 0
judge = 0

if W == x and H == y:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif W == x and H == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()	
elif W == 0 and H == y:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif x == 0 and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()

Wmin = min(W * y, W * (H - y))
Hmin = min(x * H, (W - x) * H)
Amax = max(Wmin, Hmin)

if Wmin == Hmin:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
Wmim = 0
Hmin = 0
judge = 0

if W == x or H == y:
	Amax = W * H / 2
	print(Amax, judge)
	exit()
elif x == 0 and y == 0:
	Amax = W * H / 2
	print(Amax, judge)
	exit()

Wmin = min(W * y, W * (H - y))
Hmin = min(x * H, (W - x) * H)
Amax = max(Wmin, Hmin)

if Wmin == Hmin:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
Wmim = 0
Hmin = 0
judge = 0

if W == x or H == y:
	Amax = W * H / 2
	print(Amax, judge)
	exit()

Wmin = min(W * y, W * (H - y))
Hmin = min(x * H, (W - x) * H)
Amax = max(Wmin, Hmin)

if Wmin == Hmin:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
Wmim = 0
Hmin = 0
judge = 0

Wmin = min(W * y, W * (H - y))
Hmin = min(H * x, H * (W - x))
Amax = max(Wmin, Hmin)

if Wmin == Hmin:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
Amax = 0
judge = 0
Amax = min(W * y, H * x)

if W * y == H * x:
	judge = 1

print(Amax, judge)

Submission status: Wrong Answer

Solution code:
W, H, x, y = (int(i) for i in input().split())
if x==int(W/2) and y==int(H/2):
  print(W*H/2, 1)
else:
  print(W*H/2, 0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = (int(i) for i in input().split())
if x==int(W/2) and y==int(H/2):
  print(W*H/2, 0)
else:
  print(W*H/2, 1)

Submission status: Wrong Answer

Solution code:
W, H, x, y = (int(i) for i in input().split())
if x==W/2 and y==H/2:
  print(W*H/2, 0)
else:
  print(W*H/2, 1)

Submission status: Wrong Answer

Solution code:
import sys,math
W,H,x,y = map(int,input().split())
if (x,y) == (0,0) or (x,y) == (W,0) or (x,y) == (0,H) or (x,y) == (W,H):
    print(W*H/2,'0')
elif x == 0 or x == W :
    if H/2 == y:
        print(W*H/2,'1')
    else:
        print(W*H/2,'0')
elif y == 0 or y == H :
    if W/2 == x:
        print(W*H/2,'1')
    else:
        print(W*H/2,'0')
else:
    if W/2 == x and H/2 == y:
        print(W*H/2,'1')
    else:
        print(W*H/2,'0')

Submission status: Wrong Answer

Solution code:
import sys,math
W,H,x,y = map(int,input().split())
if (x,y) == (0,0) or (x,y) == (W,0) or (x,y) == (0,H) or (x,y) == (W,H):
    print(W*H/2,'0')
    sys.exit()
elif x == 0 or x == W :
    if H/2 == y:
        print(W*H/2,'1')
        sys.exit()
    else:
        print(W*H/2,'0')
        sys.exit()
elif y == 0 or y == H :
    if W/2 == x:
        print(W*H/2,'1')
        sys.exit()
    else:
        print(W*H/2,'0')
        sys.exit()
else:
    if W%x ==0 and H%y == 0:
        print(W*H/2,'1')
        sys.exit()
    else:
        print(W*H/2,'0')
        sys.exit()

Submission status: Wrong Answer

Solution code:
import sys,math
W,H,x,y = map(int,input().split())
if x!=0 and y!=0:
    if W % x == 0 and H % y == 0 and H!=y and W!=x:
        print(W*H/2,'1')
else:
    print(W*H/2,'0')

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
x_ratio = abs(0.5 - x/float(W))
y_ratio = abs(0.5 - y/float(H))
ans = (0.5 - min(x_ratio, y_ratio)) * W * H
alt = 0
if x_ratio == y_ratio:
  alt = 1
 
if W == 1 and H == 1:
  print("1.0 0")
elif W == 1:
  print(str((0.5 - y_ratio) * W * H) + " 0")
elif H == 1:
  print(str((0.5 - x_ratio) * W * H) + " 0")
else:
  print(str(ans) + " " + str(alt))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
x_ratio = abs(0.5 - x/float(W))
y_ratio = abs(0.5 - y/float(H))
ans = (0.5 - min(x_ratio, y_ratio)) * W * H
alt = 0
if x_ratio == y_ratio:
  alt = 1

if W == 1:
  print(str((0.5 - y_ratio) * W * H) + " 0")
elif H == 1:
  print(str((0.5 - x_ratio) * W * H) + " 0")
else:
  print(str(ans) + " " + str(alt))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
x_ratio = abs(0.5 - x/float(W))
y_ratio = abs(0.5 - y/float(H))
ans = (0.5 - min(x_ratio, y_ratio)) * W * H
alt = 0
if x_ratio == y_ratio:
  alt = 1
if W == 1 and H == 1:
  print(str(1.0) + " 0")

else:
  print(str(ans) + " " + str(alt))

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
print("%f %d"%(w*h/2,int(h*x==w*y)))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
x_ratio = abs(0.5 - x/float(W))
y_ratio = abs(0.5 - y/float(H))
ans = (0.5 - min(x_ratio, y_ratio)) * W * H
alt = 0
if x_ratio == y_ratio:
  alt = 1
print(str(ans) + " " + str(alt))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
x_ratio = 1 - x/float(W)
y_ratio = 1 - y/float(H)
ans = max(x_ratio, y_ratio) * W * H
alt = 0
if x_ratio == y_ratio:
  alt = 1
print(str(ans) + " " + str(alt))

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int, input().split())
if x == int(w/2) and y == int(h/2):
    print(0.5*w*h ,1)
else:
    print(0.5*w*h ,0)