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:
W,H,x,y = map(int,input().split())
if W==x and x==0:
    print(min(W-x,W-(W-x))*H/2,str(0))
elif H==y and y==0:
    print(min(H - y, H - (H - y)) * W / 2,str(0))
else:
    xs = min((W-x)*H,(W-(W-x))*H)
    ys = min((H-y)*W,(H-(H-y))*W)
    if xs==ys:
        print(xs,str(1))
    else:
        print(max(xs,ys),str(0))

Submission status: Wrong Answer

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

tmp1 = ((W - x) * H)
tmp2 = (x * H)
ans1 = min(tmp1, tmp2)

tmp3 = (W * (H - y))
tmp4 = (W * y)
ans2 = min(tmp3, tmp4)

ans = max(ans1, ans2)
anscnt = 0
if ans1 == ans2:
    anscnt = 1

print(ans, end=' ')
print(0)

Submission status: Wrong Answer

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

#sqA
sqA = min(H * x, H * (W - x))
#sqB
sqB = min(y * W, (H - y) * W)

#print(sqA)
#print(sqB)

if sqA == sqB:
   #print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "1")
    print(str(max(sqA,sqB))+ ' ' + "1")
else:
   #print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "0")
    print(str(max(sqA,sqB))+ ' ' + "0")

Submission status: Wrong Answer

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

for i, j in [[0, 0], [W, 0], [W, H], [0, H]]:
    if x == i and y == j:
        print(W * H / 2, 0)
        quit()

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
s = W*H
s1 = x*H
s2 = W*y
s3 = min(x+y, H) * min(x+y, W) // 2

s1 = min(s1, s-s1)
s2 = min(s2, s-s2)
s3 = min(s3, s-s3)
sa = max(s1, s2)

if sa == s1 or sa == s2:
    print(sa, 1)
else:
    print(sa, 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# 判定
if W*y == H*x:
    judge = 1

# 面積求める
area1 = W * y
area2 = W*H - area1
area1_2 = min(area1,area2)
area3 = x * H
area4 = W*H - area3
area3_4 = min(area3,area4)
ans = max(area1_2,area3_4)

if (x,y) == (0,0) or (x,y) == (W,0) or (x,y) == (0,H) or (x,y) == (W,H):
    ans = (W * H)/2

# 判定
if area1_2 == area3_4:
    judge = 1

print("{0:.6f}".format(ans), judge)

Submission status: Wrong Answer

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

x_test = False
y_test = False

if W%2 == 0 and W//2 == x:
    x_test = True
if H%2 == 0 and H//2 == y:
    y_test = True

if x_test and y_test:
    print(W*H/2,1)
elif x_test or y_test:
    print(W*H/2,0)

else:
    x_cent = x > W/2
    y_cent = y > H/2
    s1 = max((H-y)*W, (W-x)*H)
    s2 = max((H-y)*W, x*H)
    s3 = max(y*W, x*H)
    s4 = max(y*W, (W-x)*H)
    if x_cent and y_cent:
        print(s1,1)
    elif y_cent:
        print(s2,1)
    elif x_cent:
        print(s3,1)
    else:
        print(s4,1)

Submission status: Wrong Answer

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

xs = [x, W - x, W]
ys = [y, H - y, H]

rects_x = [_x for _x in [W * (H-y), W * y] if _x != 0]
rects_y = [_y for _y in [H * (W-x), H * x] if _y != 0]

print(max(min(rects_x), min(rects_y)), 0 if min(rects_x) != min(rects_y) or (len(rects_x) != 1 and len(rects_y) != 1) else 1)

Submission status: Wrong Answer

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

tmp1 = ((W - x) * H)
tmp2 = (x * H)
ans1 = min(tmp1, tmp2)

tmp3 = (W * (H - y))
tmp4 = (W * y)
ans2 = min(tmp3, tmp4)

ans = max(ans1, ans2)
anscnt = 0
if ans1 == ans2:
    anscnt = 1

print(ans, end=' ')
print(1)

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(float,input().split())
if x == 0 and y == 0:
    print(w*h/2,"0")
elif x==0:
    print(w*h/2,"0")
elif y==0:
    print(w*h/2,"0")
elif w-x==w/2 and h-y == h/2:
    print(max(min(w*y,w*(h-y)),min(h*x,h*(w-x))),"1")
else:
    print(max(min(w*y,w*(h-y)),min(h*x,h*(w-x))),"0")

Submission status: Wrong Answer

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

#round1
A1=min(x*y+(W-x)/2+(H-y)/2, W*H-(x*y+(W-x)/2+(H-y)/2))

#round2
A2=0
if A1==min(x*H,(W-x)*H) and A1==min(y*W,(H-y)*W):
  A2=1
elif W/2!=x or H/2!=y:
  A2=1

print(A1,A2)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
flag = 1
if (W / 2) == x and (H/2) == y:
    pass
elif (W / 2) == x or (H/2) == y:
    flag = 0
elif (x == 0 or x == W) and (y == 0 or y == H):
    flag = 0
print(str(ans) + " " + str(flag))

Submission status: Wrong Answer

Solution code:
from sys import stdin

W, H, x,y=map(int, stdin.readline().split())
width=x
height=y

if x > W/2:
  width=W-x
if y > H/2:
  height=H-y
  
rect1 = width*H
rect2 = W*height

multiflg=0
if rect1 == rect2:
  multiflg=1

print("{} {}".format(max(rect1, rect2), multiflg))

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(float,input().split())
width = max(x, W-x)
height = max(y, H-y)
menseki_1 = width*H
menseki_2 = height*W
menseki = min(menseki_2,menseki_1)
if menseki_1 ==menseki_2:
    print("{:.9f}".format(menseki), '1')
elif (W*H)/2==max(menseki_2,menseki_1):
    print("{:.9f}".format(menseki), '1')
else:
    print("{:.9f}".format(menseki), '0')

Submission status: Wrong Answer

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

if (x==int(W/2)) and (y==int(H/2)):
    j=1

print(float(S/2),j)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

num = map(int, raw_input().strip().split())

if num[0]/2 == num[2] and num[1]/2 == num[3]:
    print (float(num[0] * num[1]))/2.0, 1
else:
    print (float(num[0] * num[1]))/2.0, 0

Submission status: Wrong Answer

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

if W % 2 == x or H % 2 == y or min(x, W - x) * H == min(y, H - y) * W:
  print(str(max(min(x, W - x) * H, min(y, H - y) * W)) + " " + "1")
else:
  print(str(max(min(x, W - x) * H, min(y, H - y) * W)) + " " + "0")

Submission status: Wrong Answer

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

a = min(x * H, (W - x) * H)
b = min(y * W, (H - y) * W)

if a == b: print('{:.6f} 1'.format(a))
elif a < b: print('{:.6f} 0'.format(b))
else: print('{:.6f} 0'.format(a))

Submission status: Wrong Answer

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

rect = w * h
maximum = -1
cnt = 0

# (0, 0)からの線で分割
if x != 0 and y != 0:
    a = y / x
    if x >= y:
        yw = a * w
        s = w * yw * 0.5
    else:
        xh = h / a
        s = xh * h * 0.5
    if maximum < s:
        maximum = s
        cnt = 1
    elif maximum == s:
        cnt += 1

# (0, W)
if x != w and y != 0:
    x_ = w - x
    a = y / x_
    if x_ >= y:
        yw = a * w
        s = w * yw * 0.5
    else:
        xh = h / a
        s = xh * h * 0.5
    if maximum < s:
        maximum = s
        cnt = 1
    elif maximum == s:
        cnt += 1

# (H, 0)
if x != 0 and y != h:
    y_ = h - y
    a = y_ / x
    if x >= y_:
        yw = a * w
        s = w * yw * 0.5
    else:
        xh = h / a
        s = xh * h * 0.5
    if maximum < s:
        maximum = s
        cnt = 1
    elif maximum == s:
        cnt += 1

# (W, H)
if x != w and y != w:
    x_ = w - x
    y_ = h - y
    a = y_ / x_
    if x_ >= y_:
        yw = a * w
        s = w * yw * 0.5
    else:
        xh = h / a
        s = xh * h * 0.5
    if maximum < s:
        maximum = s
        cnt = 1
    elif maximum == s:
        cnt += 1

# x' = xの線で分割
if y != 0 and y != h:
    y_ = min(y, h - y)
    s = w * y_
    if maximum < s:
        maximum = s
        cnt = 1
    elif maximum == s:
        cnt += 1

# y' = yの線で分割
if x != 0 and x != w:
    x_ = min(x, w - x)
    s = h * x_
    if maximum < s:
        maximum = s
        cnt = 1
    elif maximum == s:
        cnt += 1

if cnt > 1:
    print(maximum, 1)
else:
    print(maximum, 0)

Submission status: Wrong Answer

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

sq = (W * H) / 2

someFlg = 1

tilt = H / W

if x == W / 2:
    someFlg = someFlg + 1
if y == H / 2:
    someFlg = someFlg + 1

someFlg = someFlg % 2

if x == 0 or y == 0 or x == W or y == H:
    someFlg = 0

if y == x * tilt:
    someFlg = 0
if y == H - (x * tilt):
    someFlg = 0


print(str(sq) + " " + str(someFlg))

Submission status: Wrong Answer

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

print(W*H/2)

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

Submission status: Wrong Answer

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

s1 = min(x*h, (w-x)*h)
s2 = min(y*w, (h-y)*w)

if s1==s2:
    print(s1, 1)
else:
    print(max(s1,s2), 0)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
  Num = list(map(int,input().split(" ")))
  Result1 = 0
  Result2 = 0
  
  if Num[2] == 0 or Num[3] == 0:
    Result1 = 0
  else:
    if Num[1] / 2 > Num[3]:
      Mem1 = (Num[0] * Num[3]) / 2
    else:
      Mem1 = (Num[0] * (Num[1]-Num[3]))
    if Num[0] / 2 > Num[2]:
      Mem2 = (Num[1] * Num[2])/2
    else:
      Mem2 = (Num[1] * (Num[0] - Num[2]))
    if Mem1 > Mem2:
      Result1 = Mem1
    else:
      Result1 = Mem2
  
  if Num[2] == Num[0] / 2 and Num[3] == Num[1] / 2:
    print(str(float(Result1)) + " 1")
  else:
    print(str(float(Result1)) + " 0")

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(s) for s in input().split()]

def main():
    if (x, y) in [(0, 0), (0, H), (W, 0), (W, H)]:
        print(W * H / 2, "0")
        return
    r1 = min(x * H, (W-x) * H)
    r2 = min(y * W, (H-y) * W)
    print(max(r1, r2), "1" if r1 == r2 else "0")
main()

Submission status: Wrong Answer

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

s1 = float(min(W - x, x) * H)
s2 = float(W * min(H - y, y))
ans1 = max(s1, s2)
ans2 = int(x * H == W * y)
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
Gx, Gy = W/2, H/2
if Gx < x:
    x = Gx - x
if Gy < y:
    y = H - y
s1, s2 = x*H, y*W 
print(max(s1, s2), 0 if s1 != s2 else 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
answer = -1
if x == W/2:
    answer += 1
    if y == H/2:
        answer += 1
    print(str(W*H/2)+' '+str(answer))
    exit()
 
elif y == H/2:
    answer += 1
    if x == W/2:
        answer += 1
    print(str(W*H/2)+' '+str(answer))
    exit()

else:
    cou = 0
    if min(W-x,x)*H == min(H-y,y)*W:
        cou = 1
    ans = max(min(W-x,x)*H,min(H-y,y)*W)
    print(str(ans)+' '+str(cou))

Submission status: Wrong Answer

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

xs = [x, W - x, W]
ys = [y, H - y, H]

rects_x = [_x for _x in [W * (H-y), W * y] if _x != 0]
rects_y = [_y for _y in [H * (W-x), H * x] if _y != 0]

print(max(min(rects_x), min(rects_y)), 0 if min(rects_x) != min(
    rects_y) and len(rects_x) == 1 and len(rects_y) == 1 else 1)

Submission status: Wrong Answer

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

tmp1 = ((W - x) * H)
tmp2 = (x * H)
ans1 = min(tmp1, tmp2)

tmp3 = (W * (H - y))
tmp4 = (W * y)
ans2 = min(tmp3, tmp4)

ans = max(ans1, ans2)
anscnt = 0
if ans1 == ans2:
    anscnt = 1

print(ans, end=' ')
print(anscnt)

Submission status: Wrong Answer

Solution code:
def main():

    w,h,x,y=list(map(int,input().split()))
    if(x==w/2 and y==h/2):
        s=w*h/2
        print(s,1)
    
    elif(x==w/2 or y==h/2):
        s=w*h/2
        print(s,0)

    else:
        s_11=w*(h-y)
        s_12=w*y
        S1=max([s_11,s_12])
        s_21=h*x
        s_22=h*(w-x)
        S2=max([s_21,s_22])

        if S1==S2:
            S=w*h/2
            print(S,0)
        else:
            S=max([S1,S2])
            print(S,0)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
W , H , x , y = map(int,input().split())
if x == 0 or x == W:
	x_on_line = True
else:
	x_on_line = False
if y == 0 or y == H:
	y_on_line = True
else:
	y_on_line = False


if x_on_line or y_on_line:
	S = W * H / 2
	pattern = 0
else:
	if (W / 2) == float(x):
		x_half_point = True
	else:
		x_half_point = False
	if (H / 2) == float(y):
		y_half_point = True
	else:
		y_half_point = False
	x_min = min(x,W - x)
	y_min = min(y,H - y)
	S = max((x_min * H),(y_min * W))
	if S == x_min * H:
		if y_half_point:
			pattern = 1
		else:
			pattern = 0
	else:
		if x_half_point:
			pattern = 1
		else:
			pattern = 0
			
print(S,pattern)

Submission status: Wrong Answer

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

sq0 = W*H/2
sq1 = (W/2 - abs(W/2 - x)) * H
sq2 = W * (H/2 - abs(H/2 - y))

if x == 0 or x == W or y == 0 or y == H: print(sq0, 0)
elif x == int(W/2) and y == int(H/2): print(sq0, 1)
elif W*y == H*x or W*y == -H*x + W*H: print(sq0, 0)
elif sq1 == sq2: print(sq1, 1)
elif sq1 > sq2: print(sq1, 0)
elif sq1 < sq2: print(sq2, 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)
else:
  print((w*h)/2,0)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
if (w-x)*h==w*(h-y):
    print('{:6f}'.format((w-x)*h),1)
elif min((w-x)*h,x*h)>min(w*(h-y),w*y):
    print('{:6f}'.format(min((w-x)*h,x*h)),0)
else:
    print('{:6f}'.format(min(w*(h-y),w*y)),0)

Submission status: Wrong Answer

Solution code:
#coding:utf-8

a = list(map(int,input().split()))
w = a[0]
h = a[1]
x = a[2]
y = a[3]

s = w*h

print(s/2,end='')

if min(x/w,1-x/w) == min(y/h, 1-y/h):
    print(" 0")
else:
    print(" 1")

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if x == 0 and y == 0:
    print(0, 0)
elif x == W and y == 0:
    print(0, 0)
elif x == 0 and y == H:
    print(0, 0)
elif x == W and y == H:
    print(0, 0)
else:
    # 横分割の時の最小値を求める
    A = min((H-y)*W, y*W)

    # 縦分割の時の最小値を求める
    B = min((W-x)*H, x*H)

    # 最後に最大の方を選ぶ
    # このときA=Bなら複数あるということ
    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 W / 2 == x and H / 2 == y:
    flag = '1'
    s = (W / 2) * H

if W / 2 == x and H / 2 != y:
    flag = '0'
    s = (W / 2) * H

if W / 2 != x and H / 2 == y:
    flag = '0'
    s = W * (H / 2)

if W / 2 != x and H / 2 != y:
    flag = '0'
    if W >= H:
        if W - x >= x:
            s = H * (W - x)
        else:
            s = H * x
    else:
        if H - y >= y:
            s = W * (H - y)
        else:
            s = W * y
print('{} {}'.format(s, flag))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int,input().split())
buf_x = W-x
buf_y = H-y
if buf_x >= x:
  ver_area = H*x
else:
  ver_area = H*buf_x
if buf_y >= y:
  hori_area = W*y
else:
  hori_area = W*buf_y

if W==H:
  print(float(ver_area),1)
else:
  if ver_area <= hori_area:
    print(float(hori_area),0)
  else:
    print(float(ver_area),0)

Submission status: Wrong Answer

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

tate1 = x * H
tate2 = (W-x) * H
yoko1 = W * (H-y)
yoko2 = W * y

ans = [0, 0]
if tate1 == tate2 == yoko1 == yoko2:
    ans[0] = tate1
    ans[1] = 1
else:
    ans[0] = max(min(tate1, tate2), min(yoko1, yoko2))
    

print(ans[0], ans[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag = '0'
size = 0

size1 = w * h
size2 = (w - x) * h
size3 = w * x
size4 = w * (h - y)

min_size1 = min(size1, size2)
min_size2 = min(size3, size4)

if min_size1 == min_size2:
	flag = '1'

if min_size1 < min_size2:
	size = min_size2
else:
	size = min_size1


print(size, flag)

Submission status: Wrong Answer

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

if x==0 or x==W:
  minx=min(x,W-x)
  minS=minx*H
  print(minS+(W*H-2*minS)/2,0)
elif y==0 or y==H:
  miny=min(y,H-y)
  minS=miny*W
  print(minS+(W*H-2*minS)/2,0)
else:
  S1,S2=H*x,(W-x)*H
  S3,S4=W*y,(H-y)*W

  print(max(min(S1,S2),min(S3,S4)), 1 if min(S1,S2)==min(S3,S4) else 0)

Submission status: Wrong Answer

Solution code:
# 2019/06/16
# AtCoder Beginner Contest 130 - C

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

# Case "|"
lsq = h * x
rsq = h * (w - x)
wk1 = min(lsq, rsq)

# Case "-"
usq = y * w
dsq = (h - y) * w
wk2 = min(usq, dsq)

# Case Equal
if wk1 == wk2:
    ans2 = 1
else:
    ans2 = 0

ans1 = max(wk1, wk2)

if (w == x and h == y) or (x == 0 and y == 0) or (w == x and y == 0) or (x == 0 and h == y):
    ans1 = (w * h) / 2
    ans2 = 0
elif (h / y) * x == w or (h / y) * (w - x) == w:
    ans1 = (w * h) / 2
    ans2 = 0

# Output
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    token = lines[0].split(" ")
    w = int(token[0])
    h = int(token[1])
    x = int(token[2])
    y = int(token[3])

    return (w, h, x, y)


def solve(w, h, x, y):

    left = x
    right = w - x

    above = h - y
    below = y

    area1 = min(left * h, right * h)
    area2 = min(w * below, w * above)

    area = max(area1, area2)

    duplicate = 0   
    if area1 == area2:
        duplicate = 1

    print("%f %d" % (area, duplicate))




def main():
    # 出力

    # print("%s" % solve(*parse_input()))
    solve(*parse_input())


if __name__ == '__main__':

    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
def S1(W, H, x, y):
    w = W / 2
    if(x <= w):
        return H * x / 1.000000
    else:
        return H * (W - x) / 1.000000
def S2(W, H, x, y):
    h = H / 2
    if(y <= h):
        return W * y / 1.000000
    else:
        return W * (H - y) / 1.000000

def S3(W, H, x, y):
    return W * H / 2.000000


ans1 = max(S1(W, H, x, y), S2(W, H, x, y), S3(W, H, x, y))
if((S1(W, H, x, y) ==  S3(W, H, x, y)) or (S2(W, H, x, y) == S3(W, H, x, y))):
    ans2 = 1
else:
    ans2 = 0

print(str(ans1) + " " + str(ans2))

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()] 

if x==y:
    area = W*H/2
    if W/2==x and H/2==y:
        num=1
    else:
        num=0

elif (x, y)==(0, 0) or (x, y)==(W, 0) or (x, y)==(W, H) or (x, y)==(0, H):
    area = W*H/2
    num = 0
else:
    x_u = W-x
    x_d = x

    x_pat = [x_u*H, x_d*H]

    y_u = H-y
    y_d = H-y

    y_pat = [y_u*W, y_u*W]

    if min(x_pat)>min(y_pat):
        area = float(min(x_pat))
    else:
        area = float(min(y_pat))

    if min(x_pat)==min(y_pat):
        num = 1
    else:
        num = 0
    
print(area, num)

Submission status: Wrong Answer

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

div = 0
if x == H/2 and y==W/2 and H%2==0 and W%2==0:
    div=1
print((H*W/2.0), div)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

P = W * H
d1 = x * H
d2 = (W - x) * H
mi1 = min(d1, d2)
d3 = y * W
d4 = (H - y) * W
mi2 = min(d3, d4)
if mi1 > mi2:
    print(mi1, int(H // 2 == y))
elif mi1 < mi2:
    print(mi2, int(W // 2 == x))
else:
    print(max(mi1, mi2), 1)

Submission status: Wrong Answer

Solution code:
def main():

    w,h,x,y=list(map(int,input().split()))
    if(x==w/2 and y==h/2):
        s=w*h/2
        print(s,1)
    
    elif(x==w/2 or y==h/2):
        s=w*h/2
        print(s,0)

    else:
        s_11=w*(h-y)
        s_12=w*y
        S1=max([s_11,s_12])
        s_21=h*x
        s_22=h*(w-x)
        S2=max([s_21,s_22])

        if S1==S2:
            S=w*h/2
            print(S,1)
        else:
            S=max([S1,S2])
            print(S,0)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int,input().split())
buf_x = W-x
buf_y = H-y
if buf_x >= x:
  ver_area = H*x
else:
  ver_area = H*buf_x
if buf_y >= y:
  hori_area = W*y
else:
  hori_area = W*buf_y

if W==H:
  print(ver_area,1)
else:
  if ver_area <= hori_area:
    print(hori_area,0)
  else:
    print(ver_area,0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if x == 0 and y == 0:
    S = W*H/2
    bo = 0
else:
    ta = (W-x)*H
    yo = (H-y)*W
    S = ta if ta >= yo else yo
    bo = 1 if ta == yo else 0
print(S, bo)

Submission status: Wrong Answer

Solution code:
def get_has_other_ans(x, y):
  if (x == 0 or y == 0 or x == w or y == h) :
    return 1
  else :
    return 0

w, h, x, y = [int(i) for i in input().split(" ")]
  
square1 = x * h
square2 = x * (h - y)
square3 = (w - x) * h
square4 = (w - x) * (h - y)

# print(square1, square2, square3, square4)

max = square1
has_other_ans = 0

if (max < square2):
  max = square2
# elif (max == square2) :
#   has_toher_ans = 1
  
if (max < square3):
  max = square3
# elif (max == square3) :
#   has_toher_ans = 1
  
if (max < square4):
  max = square4
# elif (max == square4) :
#   has_toher_ans = 1
  
if (x == y) :
  has_other_ans = 1

  
print(max, has_other_ans)

Submission status: Wrong Answer

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

def solve(W,H,x,y):
  if ((x == W and y == H) or 
      (x == 0 and y == 0) or 
      (x == 0 and y == H) or 
      (x == W and y == 0) or
      y == int((H / W) * x)):
    return (W * H / 2, 0)
  
  s1 = min(x, W - x) * H
  s2 = min(y, H - y) * W

  if s1 == s2:
    return (s1,1)
  elif s1 > s2:
    return (s1,0)
  else:
    return (s2,0)
  
print(" ".join(map(str,solve(W,H,x,y))))

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
sq = 0
nearX = x - (w / 2)
nearY = y - (h / 2)

if x==0 or y==0:
    print('0' + ' 1')
elif nearY < nearX:
    sq = w * (h / 2)
    print(str(sq) + ' ' + '0')
elif nearX < nearY:
    sq = h * (w / 2)
    print(str(sq) + ' ' + '0')
else:
    sq = h * (w / 2)
    print(str(sq) + ' ' + '1')

Submission status: Wrong Answer

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

S = W * H

a = x * H
b = S - a
c = y * W
d = S - c

k = max(a, b)
l = max(c, d)

flag = 0
if k < l:
    s = k
    if s == c and s == d:
        flag = 1
else:
    s = l
    if s == a and s == b:
        flag = 1

if [x, y] == [0, 0] or [x, y] == [0, H] or [x, y] == [W, 0] or [x, y] == [W, H]:
    flag = 0

print(s * 1.0, flag)

Submission status: Wrong Answer

Solution code:
from sys import stdin

W, H, x, y = [int(x) for x in stdin.readline().rstrip().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:
w,h,x,y = map(int, input().split())

s1 = min(x*h, (w-x)*h)
s2 = min(y*w, (h-y)*w)

if s1==s2:
    print(s1, 1)
else:
    print(min(s1,s2), 0)

Submission status: Wrong Answer

Solution code:
WHxy = list(map(int, input().split()))
W = WHxy[0]
H = WHxy[1]
x = WHxy[2]
y = WHxy[3]

Xeq = H * (W-x)
Yeq = W * (H-y)

if x == 0:
    Xeq = 0
if y == 0:
    Yeq = 0

judge = 0
if Xeq == Yeq:
    judge = 1


if Xeq < Yeq:
    print("{} {}".format(Yeq,judge))
else:
    print("{} {}".format(Xeq, judge))

Submission status: Wrong Answer

Solution code:
w,h,x,y = list(map(int,input().split()))
ans = 0
if x == 0 and y == 0:
    print(h * w /2 , 0)
elif x == 0:
    print(min(abs(h-y) * w,y* w),0)
elif y == 0:
    print(min(abs(w-x) * h, x * h), 0)
else:
    if y/x == h/w:
        print(h * w /2,1)
    else:
        ans = max(abs(w-x) * h,abs(h-y) * w)
        print(ans,0)

Submission status: Wrong Answer

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

if x == 0 or y == 0 or x == W or y == H:
    print(area/2, 0)
elif W == H and W % 2 == 0 and W//2==x and W//2==y:
    print(area/2, 1)
elif W == H and W % 2 == 0 and (x+y==W or x==y):
    print(area/2, 0)
else:
    lr = H * min(H-y, y)
    ud = W * min(W-x, x)
    ans = max(lr, ud)
    if lr == ud:
        print(ans, 1)
    else:
        print(ans, 0)

Submission status: Wrong Answer

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

Rectangle = W * H

if x == W and y == H:
    print(Rectangle/2, ' ', 0)
    exit()


# xで分割する場合と, yで分割する場合がある
Rectangle_cuts = []

Rectangle_cuts.append(x*H)
Rectangle_cuts.append((W-x)*H)
Rectangle_cuts.append(W*y)
Rectangle_cuts.append(W*(H-y))

hoge = min(Rectangle_cuts[0], Rectangle_cuts[1])
fuga = min(Rectangle_cuts[2], Rectangle_cuts[3])

if hoge == fuga:
    print(hoge, ' ', 1)
else:
    print(max(hoge, fuga), ' ', 0)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
A = [x*h, (w-x)*h]
B = [w*y, w*(h-y)]
C = min(A)
D = min(B)
E = max(C, D)
if C == D:
    print("{0:.6f}".format(E), 1)
else:
    print("{0:.6f}".format(E), 0)

Submission status: Wrong Answer

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

a_x = min(x, W - x)
a_y = min(y, H - y)

if (W < H):
    l = H
    m = a_x
else:
    l = W
    m = a_y

ans = l * m

if (x == W/2 and y == H/2):
    multi_ans = 1
elif (W == H and (x != 0 and y != 0)):
    multi_ans = 1
else:
    multi_ans = 0

print("{} {}".format(ans, multi_ans))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(float, raw_input().split())
x1 = x * H
x2 = (W-x) * H
y1 = y * W
y2 = (H-y) * W
minx = min(x1, x2)
miny = min(y1, y2)
max = max(minx, miny)

if minx == 0 and miny == 0:
    print(str(H * W) + " 0")
elif minx == 0:
    print(str(miny) + " 0")
elif miny == 0:
    print(str(minx) + " 0")
elif min(x1, x2) == min(y1, y2):
    print(str(max) + " 1")
else:
    print(str(max) + " 0")

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(float, input().split())
S = max(min(x*H, (W-x)*H), min(W*y, W*(H-y)))
cond = 1 if min(x*H, (W-x)*H)==min(W*y, W*(H-y)) else 0
    
print(S, cond)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
flag = 1
if (W / 2) == x and (H/2) == y:
    pass
elif (W / 2) == x or (H/2) == y:
    flag = 0
print(str(ans) + " " + str(flag))

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
flag=0
X=min([W-x,x])
Y=min([H-y,y])
#print(X,Y)
if X>0 and Y>0:
    if X*H<Y*W:
        print(Y*W,0)
    elif X*H==Y*W:
        print(X*H,1)
    else:
        print(X*H,0)
else:
    if X==0:
        print(Y*W,0)
    else:
        print(X*H,0)

Submission status: Wrong Answer

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

if x==0 or x==W:
  minx=min(x,W-x)
  minS=minx*H
  print(minS+(W*H-2*minS)/2,0)
elif x==0 or x==W:
  miny=min(y,H-y)
  minS=miny*W
  print(minS+(W*H-2*minS)/2,0)
else:
  S1,S2=H*x,(W-x)*H
  S3,S4=W*y,(H-y)*W

  print(max(min(S1,S2),min(S3,S4)), 1 if min(S1,S2)==min(S3,S4) else 0)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
if x >= w/2 and y >= h/2:
    area = max((w-x)*h, (h-y)*w)
    if (w-x)*h == (h-y)*w:
        pat = 1
    else:
        pat = 0
elif x >= w/2 and y <= h/2:
    area = max((w-x)*h, y*w)
    if (w-x)*h == y*w:
        pat = 1
    else:
        pat = 0
elif x <= w/2 and y <= h/2:
    area = max(x*h, w*y)
    if x*h == w*y:
        pat = 1
    else:
        pat = 0
elif x <= w/2 and y >= h/2:
    area = max(x*h, (h-y)*w)
    if x*h == (h-y)*w:
        pat = 1
    else:
        pat = 0
if x == w or y == h:
    area = w*h/2
    pat = 0
print(float(area), pat)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int,input().split())
a = min((w-x)*h, x*h)
b = min((w*(h-y), w*y))
m = 0
if float(y) == h - (h/w)*x or float(y) == (h/w) * x:
    b = w*h/2
    m = 0
if a == b:
    m = 1
if (x == 0 or x == w) and (y == 0 or y == h):
    b = w*h/2
    m = 0
print(str(max(a,b)) + " " + str(m))

Submission status: Wrong Answer

Solution code:
W,H,x,y = (int(i) for i in input().split())

is_double = 0
if x == W/2 and y == H/2:
    is_double = 1

if x>=W/2:
    res = (W-x)*H
else:
    res = x*H

if y>=H/2:
    res2 = (H-y)*W
else:
    res2 = y*W

res3 = 0
if x==y*W/H or x==(H-y)*W/H:
    res3 = H*W/2

print("{} {}".format(max([res,res2,res3]),is_double))

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
tate_l = x*H
tate_r = (W-x)*H
yoko_d = y*W
yoko_u = (H-y)*W
tatemin = min(tate_l,tate_r)
yokomin = min(yoko_d,yoko_u)
if tatemin < yokomin:
  print(yokomin,0)
elif tatemin > yokomin:
  print(tatemin,0)
else:
  print(tatemin,1)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
flag = 0
if (W-x)*H >= x*H:
        ans1 = x*H
elif (W-x)*H < x*H:
        ans1 = (W-x)*H

if (H-y)*W >= y*W:
        ans2 = y*W
elif (H-y)*W < y*W:
        ans2 = (H-y)*W

if ans1 > ans2:
        print(str(ans1) + ' ' + str(flag))
elif ans1 == ans2:
        flag = 1
        print(str(ans1) + ' ' + str(flag))
elif ans1 < ans2:
        print(str(ans2) + ' ' + str(flag))

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:
  w1 = min(w-x, x) + max(y/h, (h-y)/h)
  w2 = min(w-x, x) + min(y/h, (h-y)/h)
  a1 = (w1+w2) * h / 2
  h1 = min(h-y, y) + max(x/w, (w-x)/w)
  h2 = min(h-y, y) + min(x/w, (w-x)/w)
  a2 = (h1 + h2) * w / 2
  if a1 == a2:
    print(a1, 1)
  else:
    print(max(a1, a2), 0)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
a=min(x*h,(w-x)*h)
b=min(y*w,(h-y)*w)
print(max(a,b))
print('1') if a==b else print('0')