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 = [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, 1)
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())
print(w*h/2,1 if w == h and x * 2 == w and y * 2 == h else 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):
        print(h * w / 2, 1)
        return
    if (x == 0 and y == h) or (x == w and y == 0):
        print(h * 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 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 rec_1 == rec_2:
    multi = 1
  if ans == H * W / 2:
    multi = 1
  print("{} {}".format(max(rec_1, rec_2), multi))
else:
  print("{} {}".format(H * W / 2, 0))

Submission status: Wrong Answer

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


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

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

        if h % 2 == 0 or w % 2 == 0:
            print(s, 1)
        else:
            print(s, 0)
    else:
        s = w * h / 2

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


if __name__ == '__main__':
    main()

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
print(s1, s2)
if x == 0 or x == W and y == 0 or y == H:
    print(0, 1)
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())
area=w*h
if x!=0:
    if (y/x)*w>=h:
        ax=(h*x)/y
        if y!=h:
            ay=((y-h)/(w-x))*w+h
            lst=[min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ax*h)/2,(ax*h)/2),min(area-(ay*w)/2,(ay*w)/2)]
            if len(lst)==len(set(lst)):
                f=0
            else:
                f=1
            ans=max(lst)
        else:
            lst=[min(area-h*x,h*x),min(area-(ax*h)/2,(ax*h)/2)]
            if len(lst)==len(set(lst)):
                f=0
            else:
                f=1
            ans=max(lst)
    else:
        ay=(w*y)/x
        if x!=w:
            ax=((w-x)/(y-h))*h+w
            lst=[min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2),min(area-((w-ax)*h)/2,((w-ax)*h)/2)]
            if len(lst)==len(set(lst)):
                f=0
            else:
                f=1
            ans=max(lst)
        else:
            lst=[min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2)]
            if len(lst)==len(set(lst)):
                f=0
            else:
                f=1
            ans=max(lst)
else:
    lst=[min(area-w*y,w*y),min(((h-y)*w)/2,area-((h-y)*w)/2)]
    if len(lst)==len(set(lst)):
        f=0
    else:
        f=1
    ans=max(lst)
print(ans,f)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
box_s = H*W
min_x = min(box_s*(x/W),box_s*((W-x)/W))
min_y = min(box_s*(y/H),box_s*((H-y)/H))
print(max(min_x,min_y))
if min_x==min_y:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
wide, hight, x, y = map(float, 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]
# print(upper, lower, right, left, ul, rl)

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

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)
XeqL = H * x

if H * (W-x) > H * x:
    Xeq = H*x
else:
    Xeq = H * (W-x)


Yeq = W * (H-y)
YeqL = W * (y)

if W * (H-y) > W * y:
    Yeq = W*y
else:
    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=map(int,input().split())
flag=0

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

if x==w/2 and y==h/2:
    print(1)
    flag=1

if ((x!=w/2 and y==h/2) or (x==w/2 and y!=h/2) or (x==y) or (x==(-1)*y)) and flag==0:
    print(0)
elif flag==0:
    print(1)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int,input().split())
ans = 0
flag = "1"
if  ((W%2!=0 and W!=0) or (H%2!=0 and H!=0)):
    flag = "0"
ans = float(max(min((W-x)*H , x*H),min((H-y)*W , y*H)))
print(format(ans,'.6f'), flag)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W,H,x,y = [int(i) for i in input().split(" ")]
diff_x = x if (x < (W - x)) else (W-x)
diff_y = y if (y < (H - y)) else (H-y)
if H == W and ((x == y) or y == (-x + H)):
    double_ans = 1
else:
    double_ans = 0

ans1 = diff_x * H * 1.0
ans2 = diff_y * W * 1.0
ans = max(ans1, ans2)
#if W < H:
    #ans = (W / 2.0) * H
#else:
    #ans = (H / 2.0) * W
print("%s %d" % (str(ans), double_ans))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
print(W*H//2,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)

    elif(y==(h/w)*x or y==-(h/w)*x):
        s=w*h/2
        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(int,input().split())


num = 0

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
sq0 = W*H/2
if x == int(W/2) and y == int(H/2): print(sq0, 1)
else: print(sq0, 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) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0
else:
    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
    elif (x == 0 and y == 0):
        multi_ans = 1
    elif (x == 0 and y == H):
        multi_ans = 1
    elif (y == 0 and x == W):
        multi_ans = 1
    else:
        multi_ans = 0

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

Submission status: Wrong Answer

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

judge = 0

S1_x = W * y
S2_x = W * (H-y)
S1_y = x * H
S2_y = (W-x) * H

if S1_x <= S2_x:
    S_x = S1_x
else:
    S_x = S2_x

if S1_x <= S2_y:
    S_y = S1_y
else:
    S_y = S2_y

if S_x > S_y:
    S = S_x
elif S_x == S_y:
    S = S_x
    judge = 1
else:
    S = S_y

print(float(S), "1")

Submission status: Wrong Answer

Solution code:
w, h, x, y = (int(i) for i in input().split())
print(w * h / 2)
if x * 2 is w and y * 2 is h:
    print(1)
else:
    print(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:
 a=min(w-x,x)
 b=min(y,h-y)
 ans1=max(a*h,b*w)
 if a*h==b*w:
  ans2=1
 else:
  ans2=0
 print(ans1,ans2)
else:
  print(w*h/2,0)

Submission status: Wrong Answer

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

# 横分割の時の最小値を求める
A = min(float((H-y)*W), float(y*W))

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

# 最後に最大の方を選ぶ
# このときA=Bなら複数あるということ
if A == B:
    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())

# 横
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 x != 0 and y != 0 and (h / w) == (y / x):
    out1 = w * h / 2

out2 = 0
if min(men1, men2) == min(men3, men4):
    out2 = 1
if x != 0 and y != 0 and (h / w) == (y / x):
    out2 = 1

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

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))
        return

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

    left = x
    right = w - x

    above = h - y
    below = y

    if x == 0 and y > 0:
        area2 = min(w * below, w * above)
        print("%f %d" % (area2, 0))
        return

    if x > 0 and y == 0:
        area1 = min(left * h, right * h)
        print("%f %d" % (area1, 0))
        return


    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 = list(map(int, input().split(' ')))
s = 0
if x == W // 2 and y == H // 2:
    s = float(W * H) / 2
    print(s,' ', 1)
else:
    s = float(x * H)
    if s > y * W:
        s = float(y * W)
    print(s,' ',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

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

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

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

print('{} {}'.format(s, flag))

Submission status: Wrong Answer

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

if (W == x and H == y) or (x == 0 and y == 0):
  print((W*H)//2, 0)
  exit()
  
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:
a,b,c,d = list(map(int,input().split()))
sum = 0
sum = a*b
if (a//2 is c) and (b//2 is d):
    print(sum/2)
    print("1")
else:
    print(sum/2-0.000001)
    print("0")

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if W == H and x == y and W/2 == x:
    print("{0} {1}".format(W * H / 2, 1))
else:
    x_min = min(x, W - x)
    y_min = min(y, H - y)
    x_area = x_min * H
    y_area = W * y_min
    if x_area == y_area:
        if x_area != 0:
            print("{0} {1}".format(x_area, 1))
        else:
            print("{0} {1}".format(W * H / 2, 0))
    else:
        print("{0} {1}".format(max(x_area, y_area), 0))

Submission status: Wrong Answer

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

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 = [int(i) for i in input().split()] 

if y==H/W*x or y==-H/W*x+H:
    area = W*H/2
    if W/2==x and H/2==y:
        num=1
    else:
        num=0
# elif (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())

Rectangle = W * H

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

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

if x == W:
    print(min(W*y, W*(H-y)), ' ', 0)
    exit()
if y == H:
    print(min(H*x, H*(W-x)), ' ', 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])  # xに垂直な線を引いて分割して、小さい方
fuga = min(Rectangle_cuts[2], Rectangle_cuts[3])  # yに垂直な線を引いて分割して、小さい方

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

Submission status: Wrong Answer

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

a = h*min(w-x,x)
b = w*min(h-y,y)

if a==b:
    print float(w*h)/2,1
else:
    print float(w*h)/2,0

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int,input().split())
s = (w*h)/2
if x == int(w/2) and y == int(h/2):
  print("{0:.6f}".format(s), 1)
elif x == 0:
  print("{0:.6f}".format(s), 0)
elif y == 0:
  print("{0:.6f}".format(s), 0)
elif x == w:
  print("{0:.6f}".format(s), 0)
elif y == h:
  print("{0:.6f}".format(s), 0)
else:
  print("{0:.6f}".format(s), 0)

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]]
rects_y = [_y for _y in [H * (W-x), H * x]]

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

Submission status: Wrong Answer

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

total = w * h
total1_1 =(w-x) * h
total1_2 = total - total1_1
total2_1 = w * (h - y)
total2_2 = total - total2_1
min1 = 0
min2 = 0
if total1_1 <= total1_2:
    min1 = total1_1
else:
    min1 = total1_2

if total2_1 <= total2_2:
    min2 = total2_1
else:
    min2 = total2_2
if min1 == min2:
    print(str(min1) +" 1")
else:
    if min1 >min2:
        print(str(min1)  +" 0")
    else:
        print(str(min2)  +" 0")

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 x == w or y == h or x==0 or y==0:
	print(0,0)
	exit()

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())
dif = 0

if W/2 == x and H/2 == y:
    ans_men = (W * H) / 2
    dif = 1
elif W/2 == x or H/2 == y:
    ans_men = (W * H) / 2
elif W/2 <= x:
    ans_men = (W - x) * H
elif W/2 >= x:
    ans_men = x * H
elif H/2 <= y:
    ans_men = (H - y) * W
elif H/2 >= y:
    ans_men = y * W
print(ans_men, dif)

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)

k = max(tate,yoko)

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



print(k,ans,sep=" ")

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) or y==(h//2):
        print(res, 1)
    else:
        print(res, 0)

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 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and 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())

if (W == x and H == y):
    res1 = W * H / 2
    res2 = 0
elif (H == y):
    tate1 = (W - x) * H
    tate2 = x * H 
    res1 = min(tate1, tate2)
    res2 = 0
elif (W == x):
    yoko1 = W * (H - y)
    yoko2 = W * y
    res1 = min(yoko1, yoko2)
    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 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 rec_1 == rec_2:
    multi = 1
  if ans == H * W / 2:
    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:
W,H,x,y = map(int,input().split())
#print(W,H,x,y)
if x == 0 or x == W or y == 0 or y == H:
    print(W*H/2,0)
elif 2 * x == W or 2 * y == H:
    if 2 * x == W or 2 * y == H:
        print(W*H/2,1)    
    else:
        print(W*H/2,0)
else:
    print(W*H/2,1)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())
S1 = x * H
S2 = (W-x) * H
S3 = W * y
S4 = W * (H-y)
min1 = min([S1,S2])
min2 = min([S3,S4])
if min1 == min2:
    print(min1,1)
else:
    print(max([min1,min2]),0)

Submission status: Wrong Answer

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

M=W*H

mW=min(x,W-x)
mH=min(y,H-y)

if mW*2==W or mH*2==H:
    R=1
else:
    R=0

if H*mW==W*mH:
    print(M*mW/W,1)
elif W==x or H==y:
    print(M/2,0)
    exit()
elif x*H==(H-y)*W:
    print(M/2,0)
    exit()
elif (mW/W)>(mH/H):
    print(M*mW/W,0)
else:
    print(M*mH/H,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, 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, 0)
        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=[int(i) for i in input().split()]
print(w*h/2)

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
elif (W == x):
    tate1 = (W - x) * H
    tate2 = x * H 
    res1 = min(tate1, tate2)
    res2 = 0
elif (H == y):
    yoko1 = W * (H - y)
    yoko2 = W * y
    res1 = min(yoko1, yoko2)
    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:
from sys import stdin
W,H,x,y = [int(x) for x in stdin.readline().rstrip().split()]
if W == H and x == y:
    print((W*H) / 2,1)
elif (W/2) == x and (H/2) == y:
    print((W*H)/2,1)
elif x == W and y == 0:
    print((W*H)/2,0)
    
elif x == 0 and y == H:
    print((W*H)/2,0)

elif x == W and y == H:
    print((W*H)/2,0)
    
elif x == 0 and y == 0:
    print((W*H)/2,0)
    
else:
    squ1 = min(x,W-x) * float(H)
    squ2 = min(y,H-y) * float(W)
    print(max(squ1,squ2),0)

Submission status: Wrong Answer

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

x1=x*h
x2=(w-x)*h
y1=y*w
y2=(h-y)*w
f=0
if x==0 and y==0 or x==w and y==0 or x==0 and y==h or x==w and y==h:
    a=1/2*w*h
    f=1
else:    
    a=max(min(x1,x2),min(y1,y2))
if min(x1,x2)==min(y1,y2) and f==0:
    b=1
else:
    b=0
    
print(a,b)

Submission status: Wrong Answer

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

mx = min(x, w-x)*h
my = min(y, h-y)*w
if (x == 0 or y == 0) or (x == w or y == h):
    print(max(mx, my), 0)
else:
    s = w*h/2
    if h/w == y/x:
        if mx == my or my == s or s == mx:
            print(s, 1)
        else:
            print(s, 0)
    elif mx == my:
        print(mx, 1)
    else:
        print(max(mx, my), 0)

Submission status: Wrong Answer

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

W, H, x, y = float(W), float(H), float(x), float(x)

# 横分割の時の最小値を求める
A = min((H-y)*W, y*W)

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

# 最後に最大の方を選ぶ
# このときA=Bなら複数あるということ
if A == B:
    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())

def calculate(W, H, x, y):
	total_area = W*H
	way = 0
	area = 0
	if(x==W/2 or y==H/2 or (x,y)==(0,0) or (x,y)==(0,H) or (x,y)==(W,0) or (x,y)==(W,H)):
		area = total_area/2
	if(W==H and x==y):
		area = total_area/2
	if(x==W/2 and y==H/2):
		way = 1
	return area, way

area, way = calculate(W, H, x, y)

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

Submission status: Wrong Answer

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


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

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

        if h % 2 == 0 or w % 2 == 0:
            print(s, 1)
        else:
            print(s, 0)
    else:
        s = w * h / 2

        if h % 2 == 0 and w % 2 == 0:
            print(s, 1)
        else:
            print(s, 0)


if __name__ == '__main__':
    main()

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,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:
W, H, x, y = map(int, 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:
#c.py
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:
#!/usr/bin/env python3
import sys


def solve(W: int, H: int, x: int, y: int):
    ans1 = max(min((W-x)*H, x*H),min(W*(H-y), W*y))
    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:
#!/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")
elif tate_min == yoko_min:
    print(str(tate_min) + " 1")

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
temp1 = [(W-x)*H,x*H]
temp2 = [W*y,W*(H-y)]

ans = max(min(temp1),min(temp2))
if  (W/2 == x and H/2 == y):
    print(W*H/2,1)
elif x == 0 or x == W or y == 0 or y == H:
    print(W*H/2,0)
elif H/W == y/x:
    print(W*H/2,0)
elif min(temp1) == min(temp2):
    print(ans,1)
else:
    print(ans,0)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
#n = int(input()) 
w,h,x,y = (int(i) for i in input().split())

if w==x and h==y:
  ans1=w*h/2
  ans2=0
elif x==0 and y==0:
  ans1=w*h/2
  ans2=0  
elif x==w and y==0:
  ans1=w*h/2
  ans2=0
elif 0 < x < w and y==0:
  ans1=w*h/2
  ans2=1
elif 0 < x < w and y==w:
  ans1=w*h/2
  ans2=1  
elif x==0 and 0<y<h:
  ans1=w*h/2
  ans2=1  
elif x==w and 0<y<h:
  ans1=w*h/2
  ans2=1  
elif x==0 and y==h:
  ans1=w*h/2
  ans2=0  
else:
  s1=x*h
  s2=h*w-s1
  minx=min(s1,s2)
  s3=y*h
  s4=h*w-s3
  miny=min(s3,s4)

  ans1=max(minx,miny)
  if minx==miny:
    ans2=1
  else:
    ans2=0
    
print(ans1,ans2)

Submission status: Wrong Answer

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

kaburi = 0
xMin = min(y * W, (H - y) * W)
yMin = min(x * H, (W - x) * H)

if xMin == yMin:
    kaburi = 1
    ans = W * H / 2
elif x == 0 or y == 0:
    ans = W * H / 2
else:
    ans = max(xMin, yMin)

print('{0} {1}'.format(ans, kaburi))

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
S = W * H
Sx1 = x * H
Sx2 = (W - x) * H
ans1 = min(Sx1, Sx2)
Sy1 = W * y
Sy2 = W * (H - y)
ans2 = min(Sy1, Sy2)
if ans1 == ans2:
  print(ans1, 1)
else:
  print(max(ans1, ans2), 0)

Submission status: Wrong Answer

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

if w//2==x and h//2==y:
  result='1'
else:
  result='0'

s=w*h
s1=(w-x)*h
if s-s1<s1:
  s1=s-s1

s2=w*(h-y)
if s-s2<s2:
  s2=s-s2
max_s=0
if s1 <=s2:
  max_s=s2
else:
  max_s=s1

print(str("{0:.9f}".format(max_s))+' '+result)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if x >= (w / 2):
    wx = (w - x) * h
else:
    wx = (x - w) * h

if y >= (h / 2):
    hy = (h - y) * w
else:
    hy = (y - h) * w

is_some = 0
if wx == hy:
    is_some = 1

print(max(wx,hy), is_some)

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

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) or (Num[0] == Num[2] and Num[3] == 0) or (Num[1] == Num[3] and Num[2] == 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=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 x == w or y == h:
	print(0,0)
	exit()

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)