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 == H:
    #座標が真ん中の場合
    if W//2 == x and H//2 == y:
        print(W*H/2, 1, sep=' ')
    #座標がよってるとき
    else:
        if x > W-x:
            print((W-x)*H/2, 1, sep=' ')
        else:
            print(x*H/2, 1, sep=' ')

#横長の場合
# elif W > H:
    #座標が真ん中の場合
else:
    if W//2 == x and H//2 == y:
        print(W*H/2, 1, sep=' ')
    else:
        if x > W-x:
            print((W-x)*H, 0, sep=' ')
        else:
            print(x*H,0, sep=' ')
# elif W < H:
#     #座標が真ん中の場合
#     if W//2 == x and H//2 == y:
#         print(W*H/2, 1, sep=' ')
#     else:
#         if y > H-y:
#             print('このパターン')
#             print((H-y)*W/2, 0, sep=' ')
#         else:
#             print(y*W/2, 0, sep=' ')

Submission status: Wrong Answer

Solution code:

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

rect_x1 = x * H
rect_x2 = (W - x) * H

min_x = min(rect_x1, rect_x2)

rect_y1 = W * y
rect_y2 = W * (H - y)

min_y = min(rect_y1, rect_y2)

if min_x == min_y:
    print(str(min_x) + " 1")
else:
    print(str(max(min_x, min_y)) + " 0")

Submission status: Wrong Answer

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

count = 0
s = 0
if 2 * x == W and 2 * y == H:
    s = W * H / 2
    count = 4
else:
    if 2 * x == W:
        s = W * H / 2
        count = 1

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
# ansx = min([(W-x)*H,x*H])
# ansy = min([(H-y)*W,y*W])
if x == 0 and y == 0:
    print(W*H//2,0)
elif W/2 == y or H/2 == x or (W%x ==0 and H%y==0):
    print(W*H//2,1)
else:
    # print(max(ansx,ansy),0)
    print(W*H//2,0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
cnt = 0
flag = 0
area_1_x = x * H
area_2_x = (W-x) * H
area_1_y = y * W
area_2_y = (H-y) * W
if area_1_x > area_2_x:
    area_x = area_2_x
else:
    area_x = area_1_x
if area_1_y > area_2_y:
    area_y = area_2_y
else:
    area_y = area_1_y

if H == y:
    area_y = 0
elif W == x:
    area_x == 0
    
if area_x > area_y:
    m = float(area_x)
    print('{:.6f}'.format(m),"0")
elif area_x == area_y:
    m = float(area_x)
    print('{:.6f}'.format(m),"1")
else:
    m = float(area_y)
    print('{:.6f}'.format(m),"0")

Submission status: Wrong Answer

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

if x > 0 and x < W and y > 0 and y < H:
  rec_1 = W * min(y, H - y)
  rec_2 = H * min(x, W - x)
  ans = max(rec_1, rec_2)
  multi = 0
  if ans == max(rec_1, rec_2) and rec_1 == rec_2:
    multi = 1
  if min(y, H - y) * W == min(x, W - x) * H:
    multi = 1
  print("{} {}".format(max(rec_1, rec_2), multi))
else:
  if (x == 0 or x == W) and (y == 0 or y == H):
    print("{} {}".format(H * W / 2, 0))
  elif x == 0 or x == W:
    print("{} {}".format(W * min(y, H - y), 0))
  else:
    print("{} {}".format(H * min(x, W - x), 0))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
f = "0"
if ((W/2 == x and H/2 == y) or x == y) and (W != x and H != y and W != 0 and H != 0):
    f="1"
print(str(W*H/2) + " " + f)

Submission status: Wrong Answer

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

if W == H and W % 2 == 0 and H % 2 == 0 and x == W // 2 and y == H // 2:
    is_mullt_ans = 1
else:
    is_mullt_ans = 0

print(W * H / 2, is_mullt_ans)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
if w==x:
    print('{:6f}'.format(min(w*(h-y),w*y)),0)
elif h==y:
    print('{:6f}'.format(min((w-x)*h,x*h)),0)
elif (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:
def solve():
    w, h, x, y = map(float, input().split())
    if (x == 0 and y == 0) or (x == w and y == h):
        if h < w:
            print(h / 2, 0)
        elif h == w:
            print(h / 2, 0)
        else:
            print(w / 2, 1)
        return
    if (x == 0 and y == h) or (x == w and y == 0):
        if h < w:
            print(h / 2, 0)
        elif h == w:
            print(h / 2, 0)
        else:
            print(w / 2, 1)
        return
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Wrong Answer

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

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)

elif x == H or y == H:
    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,0)
    elif y_cent:
        print(s2,0)
    elif x_cent:
        print(s3,0)
    else:
        print(s4,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())

if (W == x and H == y):
    res1 = W * H / 2
    res2 = 0
else:
    tate1 = (W - x) * H
    tate2 = x * H 
    tate = min(tate1, tate2)

    yoko1 = W * (H - y)
    yoko2 = W * y
    yoko = min(yoko1, yoko2)

    res1 = max(yoko, tate)
    res2 = int(yoko == tate)

print(res1, res2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
wide, hight, x, y = map(int, input().split())

leftUpper = x*y
leftLower = x*(hight - y)
rightUpper = (wide - x) * y
rightLower = (wide - x) * (hight - y)

upper = leftLower + leftUpper
lower = leftLower + rightLower
right = rightLower + rightUpper
left = leftLower + leftUpper

ul = min(upper, lower)
rl = min(right, left)
areas = [ul, rl]

minArea = max(areas)
if areas.count(minArea) > 1:
    x = 1
else:
    x = 0
print(minArea, x)

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(int, input().split()))
s = (H-y) * W
tmp = [(H-y) * W, (H * W - (H-y) * W), H * (W-x), H * W - H * (W-x)]
tmp1 = min(tmp[0],tmp[1])
tmp2 = min(tmp[2], tmp[3])

print(max(tmp1, tmp2)+10**(-10), 1 if tmp1 == tmp2 else 0)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

if x == W and y == H:
    print(W * H / 2, 0)
elif x == 0 and y == 0:
    print(W * H / 2, 0)
elif x == W or x == 0:
    print(min(y, H - y) * x, 0)
elif y == H or y == 0:
    print(min(x, W - x) * y, 0)
else:
    horizon = min((x * H), (W - x) * H)
    vertical = min((y * W), (H - y) * W)
    flag = 0
    if horizon == vertical:
        flag = 1
    print(max(horizon, vertical), flag)

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 = W - x
if Gy < y:
    y = H - y
s1, s2 = x*H, y*W
if x == 0 or x == W and y == 0 or y ==H:
    print(0, 0)
else:
    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==0 and h%2==0:
    print(x*h,1) 
elif w%2==0:
    print(x*h,0)
elif h%2==0:
    print(y*w,0)
else:
    print(w*h/2,1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

WHxy = input()
W = int(WHxy.split(' ')[0])
H = int(WHxy.split(' ')[1])
x = int(WHxy.split(' ')[2])
y = int(WHxy.split(' ')[3])

# sukunaihou no menseki
tate_min = 0.0
yoko_min = 0.0

# tate
tate_menseki1 = float((W - x) * H)
tate_menseki2 = float((0 + x) * H)

if tate_menseki1 < tate_menseki2:
    tate_min = tate_menseki1
else:
    tate_min = tate_menseki2

# yoko
yoko_menseki1 = float(W * (H - y))
yoko_menseki2 = float(W * (0 + y))

if yoko_menseki1 < yoko_menseki2:
    yoko_min = yoko_menseki1
else:
    yoko_min = yoko_menseki2

if tate_min < yoko_min:
    print(str(yoko_min) + " 0")
elif yoko_min < tate_min:
    print(str(tate_min) + " 0")
else:
    print(str(tate_min) + " 1")

Submission status: Wrong Answer

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

ans = [min(W * y, W * H - W * y), min(H * x, W * H - H * x)]
if ans.count(max(ans)) > 1:
    f = 1
else:
    f = 0

print(max(ans),f)

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)

    elif(y==(h/w)*x or y==-(h/w)*x):
        s=w*h
        print(s,0)
        
    else:
        s_11=w*(h-y)
        s_12=w*y
        S1=min([s_11,s_12])
        s_21=h*x
        s_22=h*(w-x)
        S2=min([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(float,input().split(" "))
ans = (W * H) / 2
flag = 1
if (x == 0 or x == W) and (y == 0 or y == H):
    flag = 0
elif (W / 2) == x and (H/2) == y:
    flag = 1
elif (W / 2) == x or (H/2) == y:
    flag = 0
print(str(ans) + " " + str(flag))

Submission status: Wrong Answer

Solution code:
def solve():
    w, h, x, y = map(float, input().split())
    if (x == 0 and y == 0) or (x == w and y == h):
        if h < w:
            print(h / 2, 0)
        elif h == w:
            print(h / 2, 1)
        else:
            print(w / 2, 0)
        return
    if (x == 0 and y == h) or (x == w and y == 0):
        if h < w:
            print(h / 2, 0)
        elif h == w:
            print(h / 2, 1)
        else:
            print(w / 2, 0)
        return
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
# ansx = min([(W-x)*H,x*H])
# ansy = min([(H-y)*W,y*W])
if x == 0 or y == 0:
    print(W*H//2,1)
elif W/2 == y or H/2 == x or (W%x ==0 and H%y==0):
    print(W*H//2,1)
else:
    # print(max(ansx,ansy),0)
    print(W*H//2,0)

Submission status: Wrong Answer

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

tate1 = 0
tate2 = 0
yoko1 = 0
yoko2 = 0

tate1 = H*x
tate2 = H*(W-x)
yoko1 = y*W
yoko2 = (H-y)*W
if W == H and abs(x - W/2) < 10**-9 and abs(y-W/2) < 10**-9:
    print(str(W*H/2)+" "+"1")
elif W == H:
    print(str(W*H/2)+" "+"0")
elif min(tate1,tate2) < min(yoko1,yoko2):
    print(str(float(min(yoko1,yoko2)))+" "+str(0))
elif min(yoko1,yoko2) <min(tate1,tate2):
    print(str(float(min(tate1,tate2)))+" "+str(0))
else:
    print(str(float(min(tate1,tate2)))+" "+str(1))

Submission status: Wrong Answer

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

min1 = h * min(x, w-x)
min2 = w * min(y, h-y)

if min1 == min2:
  print("{} {}".format(float(min1),'1'))
else:
  print("{} {}".format(float(max(min1,min2)),'0'))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    W, H, x, y = map(int, input().split())
    if ((x == 0) and (y == 0)) or \
        ((x == W) and (y == 0)) or \
        ((x == 0) and (y == H)) or \
        ((x == W) and (y == H)):
            print(0, 0)
            return
    n = 0
    n = max(n, min(W - x, x) * H)
    n = max(n, min(H - y, y) * W)
    res = "0"
    if (x*2 == W and y*2 == H):
        res = "1"
    print(n, res)

main()

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:
    print(W*H/2,0)

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:
         
        print(h * w /2,0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

area = max(min((W - x) * H, x * H), min((H - y) * W, y * W))

num = 0

if (x, y) == (0, 0) or (x, y) == (W, H) or (x, y) == (W, 0) or (x, y) == (0, H):
    print((W * H) / 2, 0)
    sys.exit()

#直線上も加えよう
if (y == (W / H) * x or y == H - (H / W) * x) and (x, y) != (W / 2, H / 2):
    print(W * H / 2, 0)
    sys.exit()

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

print(area, num)

Submission status: Wrong Answer

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

# 横
men1 = w * y
men2 = w * (h-y)

# 縦
men3 = x * h
men4 = (w-x) * h


#print("{0} {1} {2} {3}".format(str(men1), str(men2), str(men3), str(men4)))
out1 = max(min(men1, men2), min(men3, men4))
if min(men1, men2) == min(men3, men4):
    out2 = 1
elif x != 0 and y != 0 and (h / w) == (y / x):
    out1 = w * h / 2
    out2 = 1
else:
    out2 = 0

print("{0} {1}".format(out1, out2))

Submission status: Wrong Answer

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

if w/2 == x and h/2 == y:
  way=1
  s=w*h/2

elif x == 0 or x == w or y == 0 or y == h:
  way=0
  s=w*h/2

else:
  oy,yh,ox,xw=y,h-y,x,w-x
  yoko=min(oy*w,yh*w)
  tate=min(ox*h,xw*h)
  way=0
  s=max(yoko,tate)

print(float(s),way)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
xMax = float()
yMax = float()
count = 0
if x > abs(w - x):
    xMax = abs(w - x) * h
elif x == abs(w - x):
    count = 1
    xMax = x * h
else:
    xMax = x * h
if y >= abs(h - y):
    yMax = abs(h - y) * w
elif y == abs(h - y):
    count = 1
    yMax = y * w
else:
    yMax = y * w

if xMax >= yMax:
    print("{} {}".format(xMax, count))
elif xMax == yMax:
    count = 1
    print("{} {}".format(xMax, count))
else:
    print("{} {}".format(yMax, count))

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 x==0 or x==w or y==0 or y==h:
  print(w*h/2)
  print('0')
else:
  print(max(a,b))
  print('1') if a==b else print('0')

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(float,input().split())
if x == 0 or y == 0 or x ==w or y==h:
    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:
def input_from_console():
    w, h, x, y = map(int, input().split())
    return w, h, x, y


def solve(w, h, x, y):
    def is_only_one_solution():
        if x == w/2 and y == h/2:
            return 1
        if x == w / 2 or y == h / w:
            return 0  # Only one
        else:
            return 1  # Something else

    only_one = is_only_one_solution()

    result = "{} {}".format(w*h /2, only_one)
    return result


def main():
    w, h, x, y = input_from_console()
    print(solve(w, h, x, y))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Submission status: Wrong Answer

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


if (x==0 and y==0) or (x==w and y==0) or (x==0 and y==h)or (x==w and y==h):
    print(h*w*0.5,0)
elif x/w == y/h or -x/w == y/h:
    if x*2 ==w:
        print(w*h*0.5,1)
    else:
        print(w*h*0.5,0)
elif x==0 or y==0 or x==w or y==h:
    print(h*w*0.5,1)
else:
    s1 = (w-x)*h
    s2 = (h-y)*w
    print(max(s1,s2),0)

Submission status: Wrong Answer

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

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

area = W * H

if x < W/2:
    min1 = x * H
else:
    min1 = (W-x) * H

if y < H/2:
    min2 = y * W
else:
    min2 = (H-y) * W

ans1 = min1
if min1 < min2:
    ans1 = min2

ans2 = 0
if min1 == min2:
    ans2 = 1

print('{:.6f} {}'.format(ans1,ans2))

Submission status: Wrong Answer

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

ans = 0
if W % 2 == 0:
    if W // 2 == x:
        ans += 1
if H % 2 == 0:
    if H //2 == y:
        ans += 1

if ans == 2:
    ans = 1
else:
    ans = 0

tate = min((W-x)*H , (x - 0)*H)
yoko = min((H-y)*W , (y - 0)*W)

if tate == yoko:
    ans = 1

k = max(tate,yoko)
print(k,ans,sep=" ")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

if x == W and y == H:
    print(W * H / 2, 0)
elif x == 0 and y == 0:
    print(W * H / 2, 0)
elif x == W or x == 0:
    print(min(y, H - y), 0)
elif y == H or y == 0:
    print(min(x, W - x), 0)
else:
    horizon = min((x * H), (W - x) * H)
    vertical = min((y * W), (H - y) * W)
    flag = 0
    if horizon == vertical:
        flag = 1
    print(max(horizon, vertical), flag)

Submission status: Wrong Answer

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

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("{:.6f}".format(menseki), '1')
elif menseki_1 == (W*H)-((H-height)*W):
    print("{:.6f}".format(menseki), '1')
elif menseki_2 == (W*H)-((W-width)*H):
    print("{:.6f}".format(menseki), '1')
else:
    print("{:.6f}".format(menseki), '0')

Submission status: Wrong Answer

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

if W / 2 == x and H / 2 == y:
  print(x*H, 1)
else:
  if W / 2 == x:
    print(x*H, 0)
  elif H / 2 == y:
    print(W*y, 0)
  else:
    print(W*y, 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 (W==x and H==y) or (x==0 and y==H) or (x==W and y==0) or (x==0 and y==0):
        ans1 = W*H/2
        print(str(ans1) + ' ' + str(flag))
elif 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())
sq = 0
nearX = x - (w / 2)
nearY = y - (h / 2)
flag = False
if (x == 0 and y == 0) or (x == w and y == h) or (x == 0 and y == h) or (x == w and y == 0):
    flag = True

if flag:
    print('0' + ' 1')
    # print('a')
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:
#!/usr/bin/env python3
import sys


def solve(W: int, H: int, x: int, y: int):
    ans1 = max(min((H-y),y)*W, min((W-x),x)*H)
    if((y == H/2) and (x == W/2)):
        ans2 = 1
    else:
        ans2 = 0

    print(ans1,ans2)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

flag = '0'
size = 0

if w==x and h==y:
	size = x*y
elif w == x:
	size = min(x*y, x*(h-y))
elif h == y:
	size = min(x*y, (w-x)*y)
else:
	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 = [int(_) for _ in input().split()]
if x==w//2 and y==h//2:f=1
else:f=0
print(w*h/2, f)

Submission status: Wrong Answer

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

print(float((w*h)/2),end=' ')

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

Submission status: Wrong Answer

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

ans1 = x*h
ans3 = (w-x)*h
ans2 = w*y
ans4 = w*(h-y)
ls1 = [ans1,ans3]
ls2 = [ans2,ans4]

if max(ans1,ans3)<max(ans2,ans4):
	m = max(ans1,ans3)
	k = ls2.count(m)
else:
	m = max(ans2,ans4)
	k = ls1.count(m)
print(m,1 if k else 0)

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(W % 2 == 0 and H % 2 == 0 and W // 2 == x and H // 2 == y))
elif mi1 < mi2:
    if W % 2 != 0:
        print(mi2, 0)
    else:
        print(mi2, int(W % 2 == 0 and H % 2 == 0 and W // 2 == x and H // 2 == y))
else:
    print(mi1, 1)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
  Num = list(map(int,input().split(" ")))
  Result1 = 0
  Result2 = 0
  
  if Num[2] == 0 and 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:
# -*- 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):
    
    if x == 0 and y == 0:
        print("%f %d" % (0.5 * w * h, 0))

    if x == w and y == h:
        print("%f %d" % (0.5 * w * h, 0))


    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:
def solve():
    w, h, x, y = map(float, input().split())
    if (x == 0 and y == 0) or (x == w and y == h):
        if h < w:
            print(h / 2, 0)
        elif h == w:
            print(h / 2, 0)
        else:
            print(w / 2, 1)
        return
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

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 menseki_1 == (W*H)-((H-height)*W):
    print("{:.9f}".format(menseki), '1')
elif menseki_2 == (W*H)-((W-width)*H):
    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())
if [x,y]==[w,h] or [x,y]==[0,h] or [x,y]==[w,0] or[x,y]==[0,0]:
    print(0.5*w*h,'0')
elif (x==0 and 0<y<h) or (x==w and 0<y<h) or (y==0 and 0<x<w) or (y==h and 0<x<w):
    print(0.5*w*h,'0')
elif 2*y==h:
    print(0.5*w*h,'1')
elif 2*x==w:
    print(0.5*w*h,'1')
else:
    print(0.5*w*h,'1')

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(int, input().split()))
s = (H-y) * W
tmp = [(H-y) * W, (H * W - (H-y) * W), H * (W-x), H * W - H * (W-x)]
tmp1 = min(tmp[0],tmp[1])
tmp2 = min(tmp[2], tmp[3])
print(max(tmp1, tmp2), 1 if tmp1 == tmp2 else 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min1 = h * min(x, w-x)
min2 = w * min(y, h-y)

if min1 == min2:
  print("{} {}".format(min1,'1'))
else:
  print("{} {}".format(max(min1,min2),'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())
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 and  Y==0:
        print(W*H/2,0)
    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 W == x or H == y or x == y == 0:
    S = W * H * 0.5
    print(S,0)
elif W/2 == x and H/2 == y:
    S = W * H * 0.5
    print(S,1)
else:
    S1 = x * H
    S2 = (W-x) * H
    S3 = W * y
    S4 = W * (H-y)
    print(max([min([S1,S2]),min([S3,S4])]),0)

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(float,input().split()))
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2
if y== 0 or y == H:
    tatemax = W*H/2
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if y >= H/2:
        yokomax = W * (H-y)
    else:
        yokomax = W * (y)
    if x >= W/2:
        tatemax = H * (W-x)
    else:
        tatemax = H * x
if yokomax == tatemax: 
    print(float(max(yokomax,tatemax)),'1')
else:
    print(float(max(yokomax,tatemax)),'0')

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 = 1 if x == 0 or y == 0 else int(x * H == W * y)
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

import sys
def input(): return sys.stdin.readline().strip()

# N = int(input())
# L = [int(x) for x in input().split()]
W, H, x, y = map(int, input().split())
# S = input()

ko = [-1] * 3
ko[0] = min(x * H, (W - x) * H)
ko[1] = min(y * W, (H - y) * W)
if (x, y) == (0, 0) or (x, y) == (0, H) or (x, y) == (W, 0) or (x, y) == (W, H) or (x != 0 and y / x == H / W) or (y != 0 and x / y == W / H):
    ko[2] = (W * H) / 2

maxm = max(ko)
print(maxm, 1 if ko.count(maxm) > 1 else 0)

Submission status: Wrong Answer

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

def main():
    W, H, x, y = map(int, input().split())

    x_c = W/2
    y_c = H/2

    S = W*H/2

    if x == x_c and y == y_c:
        print("{} {}".format(S, 1))
    elif x == x_c or y == y_c:
        print("{} {}".format(S, 0))
    else:
        print("{} {}".format(S, 1))


if __name__ == "__main__":
    main()