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())
hw = W / 2
hh = H / 2
if x <= hw and y <= hh:
    if x * H > y * W:
        print(str(x * H) + ".000000 0")
    elif x * H == y * W:
        print(str(x * H) + ".000000 1")
    else:
        print(str(y * W) + ".000000 0")
elif x <= hw and y >= hh:
    if x * H > (H - y) * W:
        print(str(x * H) + ".000000 0")
    elif x * H == (H - y) * W:
        print(str(x * H) + ".000000 1")
    else:
        print(str((H - y)* W) + ".000000 0")
elif x >= hw and y <= hh:
    if (W - x) * H > y * W:
        print(str((W - x) * H) + ".000000 0")
    elif (W - x) * H == y * W:
        print(str((W - x) * H) + ".000000 1")
    else:
        print(str(y * W) + ".000000 0")
else:
    if (W - x) * H > (H - y) * W:
        print(str((W - x) * H) + ".000000 0")
    elif (W - x) * H == (H - y) * W:
        print(str((W - x) * H) + ".000000 1")
    else:
        print(str((H - y) * W) + ".000000 0")

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
men=W*H/2
if x == 0 and y == 0:
    a=1
else:
    if x == 0:
        a=0
    else:
        a=float(y/x)
    if y == 0 and x ==W:
        a=1
b=float(H/W)
W2=float(W/2)
H2=float(H/2)
cross=0
if a == b or x == W2 or y == H2:
    if a == b and x == W2:
        cross=1
    elif a == b and y == H2:
        cross=1
    elif x == W2 and y == H2:
        cross=1
    print("{0:.6f}".format(men),cross)
elif a > b:
    anx=float(H/a)
    men=(anx*H)/2
    print("{0:.6f}".format(men),cross)
else:
    any=float(W*a)
    men=(W*any)/2
    print("{0:.6f}".format(men),cross)

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 == 0 and y == H:
    print(W * H / 2, 0)
elif x == W and y == 0:
    print(W * H / 2, 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 = map(float, 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)
p = min(a, b)
q = min(c, d)
flag = 0

if q <= p:
    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
if x == 0 or x == W or y == 0 or y == H:
    flag = 0

print(s, flag)

Submission status: Wrong Answer

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

print(max([tate, yoko]))
if tate == yoko:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

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

ans2 = 0

if(x < W/2):
    X = x
else:
    X = W-x

if(W%2 != 0):
    if(x+1 == W-x):
        ans2=1

if(y < H/2):
    Y = y
else:
    Y = H-y
    
if(H%2 != 0):
    if(y+1 == H-y):
        ans2=1

if(X*H > Y*W):
    ans1 = X*H
elif(X*H == Y*W):
    ans1 = X*H
    ans2 = 1
else:
    ans1 = Y*W

print("{:.9f}".format(ans1),ans2)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


def main():
    W, H, x, y = [int(i) for i in input().split()]
    min_x = 0
    min_y = 0
    area_a = x * (H - min_y)
    area_b = (W - x) * (H - min_y)
    area_x = min([area_a, area_b])

    area_a = (W - min_x) * y
    area_b = (W - min_x) * (H - y)
    area_y = min([area_a, area_b])

    print(max([area_x, area_y]), int(area_x == area_y))


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


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

Submission status: Wrong Answer

Solution code:
def tri(w, h, x, y):
    if x == 0 or y == 0:
        return 0
    t = h * x / y
    if t <= W:
        return H * t / 2
    else:
        return W * (W * y / x) / 2

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

s = [tri(W, H, x, y), tri(W, H, W - x, y), tri(W, H, x, H - y), tri(W, H, W - x, H - y),
    H * (x if x < (W / 2) else W - x), W * (y if y < (H / 2) else H - y)]
res = max(s)

print(res, 0 if s.count(res) <= 1 else 1)

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int,input().split())
tiisaihou=[]
def menseki(tate,yoko):
    a=tate*yoko
    b=w*h-a
    if a>b:
        tiisaihou.append(b)
    else:
        tiisaihou.append(a)
menseki((w-x),h)
menseki(w,(h-y))
if tiisaihou[1]>tiisaihou[0]:
    print(tiisaihou[1],0)
elif tiisaihou[0]>tiisaihou[1]:
    print(tiisaihou[0],0)
else:
    print(tiisaihou[1],1)

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

if x == 0 or y == 0:
    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) or (x == 0 and y == 0):
    k = (W*H)/2
    ans = 0

if H == W:
    if x == y:
        k = (W*H)/2
    elif y + x == H:
        k = (W*H)/2

print(k,ans,sep=" ")

Submission status: Wrong Answer

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

if w / 2 == x and h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif y == (h / w) * x or y == (-h * w) * x + h:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif w / 2 == x or h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 0)

# elseでミスってる
else:
    b = y - x
    check1 = w + b
    check2 = -b
    ans = (check1 * (w - check2)) / 2    
    print("{:.6f}".format(ans), 0)

Submission status: Wrong Answer

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

if x > w/2:
    x = w - x
if y > h/2:
    y = h - y

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

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

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

    if min(men1, men2) == 0:
        out1 = min(men3, men4)
    elif min(men3, men4) == 0:
        out1 = min(men1, men2)
    else:
        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:
W,H,x,y = list(map(int,input().split()))
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if float(y) >= float(H)/2:
        yokomax = float(W) * float((H-y))
    elif float(y) < float(H)/2:
        yokomax = float(W) * float(y)
#    elif y == H/2:
#        yokomax = float(W) * float(y)
    if float(x) >= float(W)/2:
        tatemax = float(H) * float((W-x))
    elif float(x) < float(W)/2:
        tatemax = float(H) *float(x)
#    elif x == W/2:
#        tatemax = float(H) * float(x)
if yokomax == tatemax: 
    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print('{:.12e}'.format(max(yokomax,tatemax)),'0')

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 == W and y == 0) or (x == 0 and y == H):
    print('{:.6f} {}'.format(W * H * 0.5, 0))
elif (W == H and x == y):
    print('{:.6f} {}'.format(W * H * 0.5, 0))
else:
    x_list = [H * x, H * (W - x)]
    y_list = [y * W, (H - y) * W]

    x_min = min(x_list)
    y_min = min(y_list)

    if x_min > y_min:
        print('{:.6f} {}'.format(x_min, 0))
    elif x_min < y_min:
        print('{:.6f} {}'.format(y_min, 0))
    elif x_min == y_min:
        print('{:.6f} {}'.format(y_min, 1))

Submission status: Wrong Answer

Solution code:
w, h, x, y = (int(i) for i in input().split())
a1 = w*h/2
a2 = 0
if (w==h and (x==w/2 or y == h/2) ) or (x==w/2 and y==h/2):
    a2 = 1

print(a1, a2)

Submission status: Wrong Answer

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

sq = w*h

qt1 = min(w*y,sq-w*y)
qt2 = min(h*x,sq-h*x)
ans = max(qt1,qt2) if qt1!=0 and qt2!=0 else 4


print("{} {}".format(ans,int(qt1==qt2)))

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:
    if W == H:
        print(H * W / 2, 1)
    else:
        print(H * W / 2, 1)

Submission status: Wrong Answer

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    W, H, x, y = map(int, input().split())
    
    h = [ W * H ] if y == 0 or y == H else [y * W, (H - y) * W]
    v = [ W * H ] if x == 0 or x == W else [H * x, (W - x) * H]

    if min(h) < min(v):
        print("{:.6f} {}".format(min(v), "1" if min(v) in h else "0"))
    else:
        print("{:.6f} {}".format(min(h), "1" if min(h) in v else "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:
        print("{0} {1}".format(max(x_area, y_area), 0))
    else:
        if x_area != 0:
            print("{0} {1}".format(x_area, 1))
        else:
            print("{0} {1}".format(W * H / 2, 0))

Submission status: Wrong Answer

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

S = W*H
ans1 = S/2
ans2 = 1
if 2*x == W or 2*y == H:
    ans2 = 0
if x == 0 or x == W or y == 0 or y == H:
    ans2 = 0
if 2*x == W and 2*y == H:
    ans2 = 1
print(ans1, ans2)

Submission status: Wrong Answer

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

if w == 2*x:
    ans1 = x*h
    ans2 = 0
    if h == 2*y and ans1==y*h:
        ans2 = 1
else:
    a = -(h-2*y)/(2*x-w)
    b = -a*x+y
    ans1 = min(w*(a*w+2*b)/2, (2*h-a*w-2*b)*w/2)
    if ans1==x*h:
        ans2 = 1
    else:
        ans2 = 0

print(ans1,' ',ans2)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

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 = map(int, input().split())

if x == w / 2 and y == h / 2:
    print(w * h / 2, 1)
elif x == w and y == h:
    print(w * h / 2, 0)
elif x == 0 and y == 0:
    print(w * h / 2, 0)
elif x == 0 and y == h:
    print(w * h / 2, 0)
elif x == w and y == 0:
    print(w * h / 2, 0)
else:
    sx = min(w * y, w * (h - y))
    sy = min(h * x, h * (w - x))
    print(max(sx, sy), 0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
#print(W,H,x,y)
S_x1 = x * H
S_x2 = (W-x) * H
S_x = min(S_x1,S_x2)

S_y1 = W * y
S_y2 = W * (H-y)
S_y = min(S_y1,S_y2)

S = {S_x,S_y}
S_l = len(S)
if S_l == 1:
    l = "1"
else:
    l ="0"
S_max = max(S)
print(S_max,l)

Submission status: Wrong Answer

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

if w / 2 == x and h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif y == (h / w) * x or y == (-h * w) * x + h:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif w / 2 == x or h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 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 H == y and W == x:
    print('{:.6f}'.format(H*W),"0")
    exit()
    
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:
    print(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:
li = list(map(int, input().split()))

S1 = min(li[0] * li[3], li[0] * (li[1] - li[3]))
S2 = min(li[2] * li[1], (li[0] - li[2]) * li[1])

if S1 == S2:
    print(S1, 1)
else:
    print(max(S1, S2), 0)

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))
W, H, x, y = inpl()
if x*2 > W:
    x = W-x
if y*2 > H:
    y = H-y

a = W*y
b = H*x
if x == 0 or y == 0:
    print(H*W/2, 0)
elif W*y == H*x:
    print(H*W/2, int(W==2*x))
elif a == b:
    print(a, 1)
elif a > b:
    print(a, 0)
else:
    print(b, 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)
s = max(a,b)
print('{:.10f}'.format(s))
if y == H*x/W:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(item) for item in input().split()]
S = W * H
if x == 0 or y == 0 or x == W or y == H:
  if (x==0 and y == 0):
    print (S/2, 1)
  else:
    print (S/2, 0)
else:
  m = max(min(x/W, 1-x/W), min(y/H, 1-y/H))
  ans_s = S * m
  ans_m = 0
  if (x/W == 0.5 and y/H==0.5):
    ans_m = 1
  print (ans_s, ans_m)

Submission status: Wrong Answer

Solution code:
w, h, x, y = (int(i) for i in input().split())
a1 = w*h/2
a2 = 0
if w==h or (x==w/2 and y==h/2):
    a2 = 1

print(a1, a2)

Submission status: Wrong Answer

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

if w / 2 == x and h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif y == (h / w) * x or y == (-h * w) * x + h:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif w / 2 == x or h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 0)

else:
    b = y - x
    check1 = w + b
    check2 = -b
    ans = (check1 * (w - check2)) / 2    
    print("{:.6f}".format(ans), 1)

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

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

# 対角線
if (x != 0 and y != 0):
    if (((W % x == 0) and (H % y ==0)) 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

# 4点
if ((x == 0 and y == 0) or (x == 0 and y == H) or (y == 0 and x == W) or (y == H and x == W)):
    multi_ans = 0
    ans = W * H / 2.0

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

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

a = w * h

print("%lf %d" % (a * 0.5, int(w // 2 == x and h // 2 == y)))

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 and y == 0:
    print(Rectangle/2, ' ', 0)
    exit()
if y == H and x == 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()

# if x == int(W/2) and y == int(H/2):
#     print(Rectangle/2, ' ', 1)
#     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:
import numpy as np
W, H ,x, y = map(int, input().split())

right_length = W - x
top_length = H -y 

width = min(W - x,x) 
height = min(H - y, y)

S_vertical = H * width
S_horizonal = W * height

flag = 0
if S_vertical == S_horizonal:
    flag = 1
S = max(S_vertical, S_horizonal)
if (x==0)or(y==0)or(x==W)or(y==H): #点が周上
    S = W * H /2
    flag = 0


print(int(S),flag)

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 x==0 or y==0 or x==w or y==h:
  print("{} {}".format(w*h/2,'0'))
else:
  if min1 == min2:
    print("{} {}".format(min1,'1'))
  else:
    if min1 > min2:
      if y==h/2:
        print("{} {}".format(max(min1,min2),'1'))
      else:
        print("{} {}".format(max(min1,min2),'0'))
    else:
      if x==w/2:
        print("{} {}".format(max(min1,min2),'1'))
      else:
        print("{} {}".format(max(min1,min2),'0'))

Submission status: Wrong Answer

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

if x == w / 2 and y == h / 2:
    print(w * h / 2, 1)
elif x == w and y == h:
    print(w * h / 2, 0)
elif x == 0 and y == 0:
    print(w * h / 2, 0)
else:
    sx = min(w * y, w * (h - y))
    sy = min(h * x, h * (w - x))
    print(max(sx, sy), 0)

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
men=W*H/2
if x == 0:
    a=0
else:
    a=float(y/x)
if y == 0 and x ==W:
    a=1
b=float(H/W)
W2=float(W/2)
H2=float(H/2)
cross=0
if a == b or x == W2 or y == H2:
    if a == b and x == W2:
        cross=1
    elif a == b and y == H2:
        cross=1
    elif x == W2 and y == H2:
        cross=1
    print("{0:.6f}".format(men),cross)
elif a > b:
    anx=float(H/a)
    men=(anx*H)/2
    print("{0:.6f}".format(men),cross)
else:
    any=float(W*a)
    men=(W*any)/2
    print("{0:.6f}".format(men),cross)

Submission status: Wrong Answer

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

left = x * h
right = (w-x) * h

lower = w * y
upper = w * (h-y)

if abs(left - right) < abs(lower - upper):
  if left < right:
    print(left, end=" ")
  else:
    print(right, end=" ")
else:
  if lower < upper:
    print(lower, end=" ")
  else:
    print(upper, end=" ")
    
if x == (w/2) and y == (h/2):
  print(1, end="")
else:
  print(0, end="")

Submission status: Wrong Answer

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


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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(float, input().split())
print(W*H/2,1)

Submission status: Wrong Answer

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

if (x == 0 or x == W) and (y == 0 or y == H):
    print("{:.10f} 0".format(W*H/2))
    sys.exit()

x1 = 0.0
x2 = 0.0
if W - x > x:
    x1 = x * H* 1.0
    x2 = (W-x) * H* 1.0
else:
    x1 = (W-x) * H* 1.0
    x2 = x * H* 1.0

y1 = 0.0
y2 = 0.0
if H - y > y:
    y1 = y * W * 1.0
    y2 = (H-y) * W* 1.0
else:
    y1 = (H-y) * W* 1.0
    y2 = y * W* 1.0

if x1 > y1:
    print("{:.10f}".format(x1), end=" ")
else:
    print("{:.10f}".format(y1), end=" ")
if x1 == y1:
    print(1)
else:
    print(0)

Submission status: Wrong Answer

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

if (W == x or H == y or x == 0 or y == 0):
    res1 = W * H / 2
    res2 = 0
elif (W/2 == x and H/2 == y):
    res1 = W * H / 2
    res2 = 1
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:
# coding: utf-8

W, H, x, y = map(float, input().split())
 
if (W - x) <= W / 2:
    Rect1 = H * (W - x)
else:
    Rect1 = H * x
    
if (H - y) <= H / 2:
    Rect2 = W * (H - y)
else:
    Rect2 = W * y

if Rect1 == 0 and Rect2 == 0:
    print(W * H, 1)
elif Rect1 > Rect2:
    print(Rect1, 0)
elif Rect1 < Rect2:
    print(Rect2, 0)
else:
    print(Rect1, 1)

Submission status: Wrong Answer

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

o1 = (w * h) / 2

l = [(x, h / w * x), (x, - h / w * x + h)]
if (x, y) in l:
  o2 = 1
else:
  o2 = 0
  
print(o1, o2)

Submission status: Wrong Answer

Solution code:
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


W,H,x,y = IL()

cnt = 0
if x*2 == W and y*2 == H:
  cnt = 1

print((H*W)//2,cnt)

Submission status: Wrong Answer

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

flag = '0'
size = 0

if (w==x and h==y) or (x==0 and y==0):
	size = h*w*0.5
elif w == x and h != y:
	if y == 0:
		size = h*w*0.5
	else:
		size = min(x*y, x*(h-y))
elif h == y and w != x:
	if x == 0:
		size = h*w*0.5
	else:
		size = min(x*y, (w-x)*y)
else:
	size1 = x * 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 or y == 0 or y == H:
    print("{:.10f}".format(W*H/2), 0)
else:
    dx1 = x - 0
    dx2 = W - x
    dy1 = y - 0
    dy2 = H - y
    if dx1 == dx2 and dy1 == dy2:
        print("{:.10f}".format(W*H/2), 1)
    elif dx1 == dx2 or dy1 == dy2:
        print("{:.10f}".format(W*H/2), 0)
    else:
        print("{:.10f}".format(W*H/2), 1)

Submission status: Wrong Answer

Solution code:

read = input 
rn = lambda :list(map(int, read().split()))
w, h, x, y = rn()
total = w * h
mx = 0

# 0
if w * x + h * y > 0:
    tmp = x * h / 2
else:
    tmp = y * w / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 1
tmp = x * h
mx = max( mx, min(total - tmp, tmp) ) 

# 2
if y * (y - h) - x * ( x - w ) > 0:
    tmp = h * (w - x) / 2
else :
    tmp = w * y / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 3
tmp = y * w
mx = max( mx, min(total - tmp, tmp) ) 

# 4
if w * y  - h * x> 0:
    tmp = w * (h - y) / 2
else :
    tmp = h * (w - x) / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 5
tmp = x * h
mx = max( mx, min(total - tmp, tmp) ) 

# 6
if y * (y - h) - x * ( x - w ) > 0:
    tmp = w * (h - y) / 2
else :
    tmp = h * x / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 7 
tmp = y * w 
mx = max( mx, min(total - tmp, tmp) ) 

import sys
el = w * h - mx
print(mx, end=' ')
if abs(el - mx ) < sys.float_info.epsilon:
    print(0)
else :
    print(1)

Submission status: Wrong Answer

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

S1 = H*x
S2 = H*(W-x)
S3 = W*y
S4 = W*(H-y)

ans_S = max(min(S1,S2), min(S3, S4))

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

print('{:.6f}'.format(ans_S), ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

w, h, x, y = input().split()
w = float(w)
h = float(h)
x = float(x)
y = float(y)

if w/2==x and h/2==y:
  print(w*h/2, 1)
elif h>=w:
  s=min(w*h-x*h, x*h)
  print(s,0)
else:
  s=min(w*h-y*w, y*w)
  print(s,0)

Submission status: Wrong Answer

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

if x > w/2:
    x = w - x
if y > h/2:
    y = h - y

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

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

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

    if min(men1, men2) == 0:
        out1 = min(men3, men4)
    elif min(men3, men4) == 0:
        out1 = min(men1, men2)
    else:
        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:
W,H,x,y=map(int, input().split())

X = H * x
if X > (W - x) * H:
  X = (W - x) * H

Y = y * W
if Y > W * (H - y):
  Y = W * (H - y)

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

if X > Y:
  print(X, 0)
elif X < Y:
  print(Y, 0)
elif X == Y:
  print(X, 1)

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 and y == h:
    print(w * h / 2, 0)
else:
    sx = min(w * y, w * (h - y))
    sy = min(h * x, h * (w - x))
    print(max(sx, sy), 0)

Submission status: Wrong Answer

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

if w%2 == 0 or h%2 == 0:
    area = w*h//2
else:
    area = w*h//2 + 0.5
    
if x == w//2 and y == h//2:
    print(area, 1)
else:
    print(area, 0)

Submission status: Wrong Answer

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

if x == 0 or x == W or y == 0 or y == H:
    print("{:.10f}".format(W*H/2), 1)
else:
    dx1 = x - 0
    dx2 = W - x
    dy1 = y - 0
    dy2 = H - y
    if dx1 == dx2 and dy1 == dy2:
        print("{:.10f}".format(W*H/2), 1)
    elif dx1 == dx2 or dy1 == dy2:
        print("{:.10f}".format(W*H/2), 0)
    else:
        print("{:.10f}".format(W*H/2), 1)

Submission status: Wrong Answer

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

S1=(H-y)*W
S2=y*W

S3=x*H
S4=(W-x)*H

m1=min(S1,S2)
m2=min(S3,S4)

if(m1==m2):
    #print(float(m1),end=' ')
    print('{:.6f}'.format(m1),end=' ')
    print(1)
else:
    M=max(m1,m2)
    #print(float(M),end=' ')
    print('{:.6f}'.format(M),end=' ')
    print(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 round(C, 9) == round(D, 9):
    print("{0:.6f}".format(E), 1)
else:
    print("{0:.6f}".format(E), 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)
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 = 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
else:
    ans_men1 = (W - x) * H
    ans_men2 = x * H
    ans_men3 = (H - y) * W
    ans_men4 = y * W
    Ans_men = [ans_men1, ans_men2, ans_men3, ans_men4]
    Ans_men.sort()
    ans_men = Ans_men[0]

print(ans_men, dif)