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/2 == x and H/2 == y:
	S = W*H/2
	print("%f %d" % (S,1))
elif x == 0 or y == 0 or x == W or y == H:
	print("0.000000 0")
else:
	S1 = min(x,W-x) * H
	S2 = min(y,H-y) * W
	if S1 == S2 or W*y == H*x or H*x + W*y == W*H:
		print("%f %d" % (max(S1,S2),1))
	else:
		print("%f %d" % (max(S1,S2),0))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if x == W or y == H or x == 0.0 or y == 0.0:
    ans = H*W/2
    ans_2 = 0
elif x*H == y*W or (W-x)*H == y*W:
    ans = H*W/2
    if float(x) == W/2 and float(y) == H/2:
        ans_2 = 1
    else:
        ans_2 = 0
elif abs(W/2-x) * (H/2) < H/2:
    ans = H*W/2
    ans_2 = 0
else:
    yoko_a = W * y
    yoko_b = W * (H-y)
    yoko = min(yoko_a, yoko_b)

    tate_a = H * x
    tate_b = H * (W-x)
    tate = min(tate_a, tate_b)
    
    ans = max(tate, yoko)
    ans = float(ans)

    if tate == yoko:
        ans_2 = 1
    else:
        ans_2 = 0

print(ans, ans_2)

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)
s = max(p, q)
flag = 0

if p < q:
    if s == a or s == b:
        flag = 1
else:
    if s == c or s == d:
        flag = 1
    
if [x, y] == [0, 0] or [x, y] == [0, H] or [x, y] == [W, 0] or [x, y] == [W, H]:
    s = 0
    flag = 0
if x == 0 or x == W or y == 0 or y == H:
    s = 0
    flag = 0

print(s, flag)

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 abs(H/W * x - y) < 10**-9 or abs(-1*H/W * x + W - y) < 10**-9 :
    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:
import numpy as np
W,H,x,y = map(int, input().split())

d_center_W = abs(W/2 - x)
d_center_H = abs(H/2 - y)
d_45_plus =  abs((H/W)*x-1*y)/np.sqrt((H/W)**2+(-1)**2)
d_45_minus = abs((H/W)*x+y-H)/np.sqrt((H/W)**2+1**2)

min_d = min(d_center_W,d_center_H,d_45_plus,d_45_minus)
smflg = False

if [d_center_W,d_center_H,d_45_plus,d_45_minus].count(min_d) > 1:
        smflg = True

ans = 0

if min_d == d_center_W:
        if x <= W/2:
                ans = x*H/1
        else:
                ans = (W-x)*H/1
elif min_d == d_center_H:
        if y <= H/2:
                ans = y*W/1
        else:
                ans = (H-y)*W/1
elif min_d == d_45_plus:
        if x == 0 and y == 0:
                ans = H*W/2
        elif x == 0:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
elif min_d == d_45_plus:
        if x <= W/2:
                x += (W/2-x)*2
        else:
                x -= (x-W/2)*2
        if x == 0:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
if smflg:
        smstr = '1'
else:
        smstr = '0'

if H == 1 and W == 1:
        ans = 1/2

print(str(ans) + ' ' + smstr)

Submission status: Wrong Answer

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

sq0 = W*H/2

if x==0 or x==W or y==0 or y==H: print(sq0, 0)
elif x == int(W/2) and y == int(H/2): print(sq0, 1)
else: print(sq0, 0)

Submission status: Wrong Answer

Solution code:


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

    flag = 0    
    result = 0
    #if x/W == y/H :
     #   flag = 1

        
    
        
    if abs(x/W - 0.5) > (abs(y/H - 0.5)):
        result = min(W * (y), W * (H - y))

    elif abs(x/W - 0.5) == (abs(y/H - 0.5)):
        result = min(H * (x), H * (W - x),W * (y), W * (H - y))
    
    else:
        result = min(H * (x), H * (W - x))


    print(result,flag)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
if x==0 or y==0 or x==w or y==h:
    print('{:6f}'.format(w*h/2),0)
elif (w-x)*h==w*(h-y):
    if (w-x)*h==x*h:
        print('{:6f}'.format(w*h/2),1)
    else:
        print('{:6f}'.format(w*h/2),0)
elif (w-x)*h==w*y and x*h==w*(h-y):
    print('{:6f}'.format(w*h/2),0)
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:
a = list(map(int,input().split()))
W = a[0]
H = a[1]
x = a[2]
y = a[3]
#W,H,x,y = list(map(int,input().split(" ").rstrip("")))
#print(W,H,x,y)
#横にラインを引く
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.0:
        yokomax = float(W) * float((H-y))
        
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
        
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
        
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
        
    elif float(x) == float(W)/2.0:
        tatemax = float(H) * float(x)
if W ==H:
    if x !=0 and x != W and y!= 0 and y != H:
        print('{:.12e}'.format(max(yokomax,tatemax)),'1')
elif W!=H:
    if yokomax == tatemax:
    #    print(max(yokomax,tatemax),'1')   
        print('{:.12e}'.format(max(yokomax,tatemax)),'1')
    else:
    #    print(max(yokomax,tatemax),'0')
        print('{:.12e}'.format(max(yokomax,tatemax)),'0')

Submission status: Wrong Answer

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

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


if min(x*H, (W-x)*H) == min(W*y, (H-y)*W):
    cnt += 1
    if minseki == x*H:
        cnt +=1
    if minseki == (W-x)*H:
        cnt += 1
    if minseki == W*y:
        cnt += 1
    if minseki == (H-y)*W:
        cnt += 1

if cnt >= 3:
    cnt = 1
else:
    cnt = 0

print(minseki, cnt)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
l = 0
S1 = 0
S2 = 0
sp = 0
ans = 0
J = []
if x<W/2 and y<H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x == W/2 and y<H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x>W/2 and y<H/2:
    S1 = (W-x)*H
    S2 = y*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x<W/2 and y == H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x == W/2 and y == H/2:
    sp += 1
    l = x*H
if x>W/2 and y == H/2:
    S1 = (W-x)*H
    S2 = y*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x<W/2 and y>H/2:
    S1 = x*H
    S2 = (H-y)*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x == W/2 and y>H/2:
    S1 = x*H
    S2 = (H-y)*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
if x>W/2 and y>H/2:
    S1 = (W-x)*H
    S2 = (H-y)*W
    l = max(S1,S2)
    if S1 == S2:
        sp += 1
ans = l
J.append(ans)
if sp >= 1:
    J.append(1)
else:
    J.append(0)
print(J[0],J[1])

Submission status: Wrong Answer

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

S_y1 = W * y
S_y2 = WH - S_y1
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(float,input().split())
ans1 = x*H
ans2 = y*W
if ans1 == ans2:
    print(ans1,1)
if ans1 > ans2:
    print(ans1,0)
if ans2 > ans1:
    print(ans2,0)

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)
s = max(p, q)
flag = 0

if p < q:
    if s == a or s == b:
        flag = 1
else:
    if s == c or s == d:
        flag = 1
    
if [x, y] == [0, 0] or [x, y] == [0, H] or [x, y] == [W, 0] or [x, y] == [W, H]:
    s = 0
    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())

flag = '0'
size = 0

if (x == 0 and y == 0) or (x == 0 and h == y) or (y == 0 and x == w) or (w==x and h==y):
	size = h * w * 0.5

elif w == x or x == 0:
	size = min(x*y, x*(h-y))

elif h == y or y == 0:
	size = min(x*y, (w-x)*y)

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

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

	if min_size1 == min_size2:
		flag = '1'
		size = min_size1

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

area1 = H*x
area2 = H*(W-x)
comp1 = min(area1,area2)

area3 = W*y
area4 = W*(H-y)
comp2 = min(area3,area4)

flag = 1 if comp1==comp2 else 0
print(str(max(comp1,comp2)) +" "+ str(flag))

Submission status: Wrong Answer

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


multi_ans = 0

# 対角線
if (x != 0 and y != 0):
    if (W / x == H / y):
        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
# 十字線
elif (W==H):
    if (x == W - x or y == H - y):
        multi_ans = 0
    else:
        multi_ans = 1


ans = W * H /2.0
print("{} {}".format(ans, multi_ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
SQs = [0] * 4
ans = 0
another = 0

if x == W / 2 or y == H / 2 or x == y or y == -x + H:
    ans = float(W*H/2)

if x == W/2 and y == H/2:
    another = 1

elif x > W/2 and y > H/2 and y > x:
    ans = float((W-x)*y)

elif x > W/2 and y > H/2 and y < x:
    ans = float(W*(H-y))

elif x > W/2 and y < H/2 and y > -x + H:
    ans = float(W*y)

elif x > W/2 and y < H/2 and y < -x + H:
    ans = float((W-x)*y)

elif x < W/2 and y < H/2 and y < x:
    ans = float(x*H)
    
elif x < W/2 and y < H/2 and y > x:
    ans = float(W*y)
    
elif x < W/2 and y > H/2 and y < -x + H:
    ans = float(W*(H-y))

elif x < W/2 and y > H/2 and y > -x + H:
    ans = float(x*H)

print(ans, ' ', another)

Submission status: Wrong Answer

Solution code:
in1 = list(map(int, input().split()))

W=in1[0]
H=in1[1]
x=in1[2]
y=in1[3]

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

Submission status: Wrong Answer

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

if w == h and w % 2 == 0:
    if x == w or y == h:
        f = w
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
    else:  
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
elif w == h and w % 2 != 0:
    f = w*h*2/3
    print('{:.6f}'.format(f),end = "")
    print(" " + str(1))
else:
    f = max(w,h)
    if f/2 -1 == x or f/2 - 1 == y :
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
    elif x == 1 and y == 1:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif  x == w and y == h:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif x == 1 and y == h:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif x == w and y == 1:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    else:
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))

Submission status: Wrong Answer

Solution code:
# 最初に入れておくとinputが早くなる
import sys
input = sys.stdin.readline

W, H, x, y = map(int, input().split())
flag = 0
if (W / 2 == x and H / 2 == y):
    flag = 1

print(min(max(x, W-x)*H, max(y, H-y)*W), flag)

Submission status: Wrong Answer

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

ver_W = min(W-x, x) * H
ver_H = min(H-y, y) * W
# ver_diag = (y-x)*(y-x)*0.5
if ver_W > ver_H:
    print str(ver_W) + ' 0' 
elif ver_H > ver_W:
    print str(ver_H) + ' 0'
else: print str(ver_W) + ' 1'

Submission status: Wrong Answer

Solution code:
W ,H, x, y=map(float, input().split())
i = 0
#sqA
sqA = min(H * x, H * (W - x))
sqA1 = H * x
sqA2 = H * (W - x)

#sqB
sqB = min(y * W, (H - y) * W)
sqB1 = y * W
sqB2 =(H - y) * W
min(sqA1,sqA2) == min(sqB1,sqB2)

if min(sqA1,sqA2) == min(sqB1,sqB2):
   print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "1")
    #print(str(max(sqA,sqB))+ ' ' + "1")
elif min(sqA1,sqA2) <= min(sqB1,sqB2):
      if sqB1==sqB2:
        print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "1")
      else:
        print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "0")
elif min(sqA1,sqA2) >= min(sqB1,sqB2):
      if sqB1==sqB2:
        print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "1")
      else:
        print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "0")

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
tmp1 = min(x*H, (W-x) * H)
tmp2 = min(W*y, W*(H-y))
e = 0
if tmp1 == tmp2:
    e = 1
print(float(max(tmp1, tmp2)), e)

Submission status: Wrong Answer

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

a = W*y
b = H*x
if x == 0 or y == 0:
    print(H*W/2, 0)
elif W/H == x/y:
    print(H*W/2, int(W/2==x))
elif a > b:
    print(a, int(2*x == W))
    raise
else:
    print(b, int(2*y == H))

Submission status: Wrong Answer

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

else:
    print("{:.9f}".format(menseki), '0')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
ans = 0
 
y_s1 = (H-y) * W
y_s2 = y * W
x_s1 = (W-x) * H
x_s2 = x * H

split_y = max(y_s1, y_s2)
split_x = max(x_s1, x_s2)

if x == y:
    ans = 1
    
print(min(split_y, split_x), ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

m1 = x * H
m2 = y * W
multi = 0

if m1 == m2:
    multi = 1

print("{:.6f} {}".format(min(m1, m2), multi))

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


if (x == 0 and y == 0) or (x == 0 and y == H) or (x == W and y == 0) or (x == W and y == H):
    ans1 = area/2
    ans2 = 0




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

Submission status: Wrong Answer

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



if x == W and y == H:
    print(x*y/2, 1)
else:
    v1 = W * H - x * H
    v2 = W * H - W * y

    a = 0.0
    f = 0
    if v1 < v2:
        a = v2
    elif v1 > v2:
        a = v1
    else:
        a = v1
        f = 1

    print(a, f)

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:
        print(s, 0)


if __name__ == '__main__':
    main()

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("{:.9f}".format(ans), 1)

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

# elseでミスってる
else:
    ans = w / 2 * h
    print("{:.9f}".format(ans), 1)

Submission status: Wrong Answer

Solution code:
from fractions import Fraction
from collections import Counter


class RectangleCutting:
    def __init__(self):
        W, H, x, y = map(int, input().split())
        self.W = W
        self.H = H
        self.x = x
        self.y = y

    def main(self):
        hs = self.H * self.W / 2
        s = []

        for p in self.__on_lines():
            s.append(hs)

        for sv in self.__separate_straight():
            s.append(sv)

        c = Counter("{}".format(s))
        if c[max(s)] > 1:
            print(max(s), 1)
        else:
            print(max(s), 0)

    def __on_lines(self):
        is_on_line = []
        # line0の傾き
        a0 = Fraction(self.H, self.W)
        # line1の傾き
        a1 = Fraction(-self.H, self.W)
        # 線上にある時, 2等分可能
        # line0について
        if self.y == a0 * self.x:
            is_on_line.append(0)
        # line1について
        if self.y == a1 * self.x + self.H:
            is_on_line.append(1)

        return is_on_line

    def __separate_straight(self):
        s = self.H * self.W
        # 縦横で分割する
        # 縦
        sv = self.x * self.H
        if sv == s:
            sv = 0
        # 横
        sh = self.y * self.W
        if sh == s:
            sh = 0

        return [sv, sh]


rectangleCutting = RectangleCutting()
rectangleCutting.main()

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

Submission status: Wrong Answer

Solution code:
t = list(map(int, input().split()))
S = t[0] * t[1] / 2
print(S,'0')

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)
s = max(p, q)
flag = 0

if p < q:
    if s == a or s == b:
        flag = 1
else:
    if s == c or s == d:
        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())

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

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

# elseでミスってる
else:
    ans = w / 2 * h
    print("{:.9f}".format(ans), 1)

Submission status: Wrong Answer

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

area = float(W * H * 0.5)
mul = 0
if x == W // 2 and y == H // 2:
    mul = 1
if W == 0 or H == 0:
    mul = 1
print(area, mul)

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)
  exit()

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

if(x == 0 and H == y) or (W == x and y == 0) or (y == b*x + H):
  print((W*H) / 2, 0)
  exit()
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:
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
    areas = []
    if 0 < x < W:
        area_a = x * H
        area_b = (W - x) * H
        areas.append(min([area_a, area_b]))

    if 0 < y < H:
        area_a = W * y
        area_b = W * (H - y)
        areas.append(min([area_a, area_b]))

    multi_flag = 0
    if len(areas) > 1 and len(set(areas)) == 1:
        multi_flag = 1
    min_area = 0
    if areas:
        min_area = max(areas)
    if not areas:
        min_area = W * H
        multi_flas = 1
    print(min_area, multi_flag)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(float,input().split())
width = min(x, W-x)
height = min(y, H-y)
menseki_1 = width*H
menseki_2 = height*W
menseki = max(menseki_2,menseki_1)
if menseki_1==menseki_2:
    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())
result=w*h/2
able=0
if x==w//2 and y==h//2:
  able=1
print(result,able)

Submission status: Wrong Answer

Solution code:
#整数＋リスト
w, h, x, y = list(map(int, input().split()))


xx = x
yy = y
if (x/w < y/h):
    xx = y
    yy = x

xxx = xx
yyy = yy
if (xx > w/2):
    xxx = w - xx
    
############
#print(xxx,yyy)

a = xxx*h
b = yyy*w

if (xxx == 0):
    c = w*h/2
else:
    c = w*w*yyy/xxx/2

mmm = w*h

if (a > mmm/2):
    a = mmm - a

if (b > mmm/2):
    b = mmm - b

if (c > mmm/2):
    c = mmm - c

#############
#print(a,b,c)

rtn = max(a,b,c)
f = -1
if (a == rtn):
    f += 1
if (b == rtn):
    f += 1
if (c == rtn):
    f += 1
if (f == 2):
    f = 1

print('{0:.9f}'.format(rtn), f)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
ans1 = x*H
ans2 = y*W
if ans1 == ans2:
    print(ans1,1)
if ans1 > ans2:
    print(ans1,0)
if ans2 > ans1:
    print(ans2,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]



minx = min(ans1,ans3)
miny = min(ans2,ans4)
k=0
if minx == miny:
	minmax=minx
	k=0
elif minx>miny:
	minmax=minx
	if minmax in ls2:
		k=1
else:
	minmax=miny
	if minmax in ls1:
		k=1

print(minmax,k)

Submission status: Wrong Answer

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


multi_ans = 0

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

# 十字線
if (W==H):
    if (x == W - x or y == H - y):
        multi_ans = 0
    else:
        multi_ans = 1


ans = W * H /2.0
print("{} {}".format(ans, multi_ans))

Submission status: Wrong Answer

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

a = W*y
b = H*x
if x == 0 or y == 0:
    print(H*W/2, 0)
elif W/H == x/y:
    print(H*W/2, int(W/2==x))
elif a == b:
    print(a, 1)
    raise
elif a > b:
    print(a, int(2*x == W))
else:
    print(b, int(2*y == H))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int, input().split())
p = 0
if (x==0)|(x==w)|(y==0)|(y==h):
  mens = w*h/2
  p = 0
elif (x==(w/2))|(y==(h/2)):
  mens = w*h/2
  if (x==(w/2))&(y==(h/2)):
    p = 1
  else:
    p = 0
elif ((x/y)==(w/h))|(y == -(h/w)*x+h):
  p = 1
  mens = w*h/2
else:
  if ((y<h/w*x)&(y<-(h/w)*x+h))|((y>h/w*x)&(y>-(h/w)*x+h)):
    p = 0
    mens = min(y,h-y)*w
  else:
    p = 0
    mens = min(x,w-x)*h
print(mens, p)

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(w*h/2,"1")
elif abs(w/2-x)==abs(h/2-y):
    print(w*h/2,"0")
else:
    print(max(min(w*y,w*(h-y)),min(h*x,h*(w-x))),"0")

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
a_top = W*y
a_under = W*(H-y)
a_left = x*H
a_right = (W-x)*H

area = max(min(a_top,a_under),min(a_left,a_right))
is_center = 0 
# 図形の中心を分割点が通る場合
if (W == x*2 and H == y*2):
  is_center =1

print("{} {}".format(area,is_center))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
w,h,x,y=map(int,input().split())
#l=[int(i) for i in input().split()]
a=[y*w,(h-y)*w]
a.sort()
b=[x*h,(w-x)*h]
b.sort()
d=[a[0],b[0]]
d.sort()
#print(a,b,d)
#0,0 x,y 
if x!=0 and abs((h/w)-(y/x)) < sys.float_info.epsilon:
    print((w*h)/2,0)
elif x!=w and abs((h/w)-y/(w-x))< sys.float_info.epsilon:
    print((w*h)/2,0)
elif (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 d[0]==d[1]:
    print(d[1],1)
else:
    print(d[1],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 or abs(H/W * x - y) < 10**-9 or abs(-1*H/W * x + W - y) < 10**-9 :
    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:
import collections
w, h, x, y = map(int, input().split())
area = []
# xの直線
area.append(min(h*x, h*(w-x)))

# yの直線
area.append(min(w*y, w*(h-y)))

# 角たち
a = w * h
if y != 0:
    if h / y * x <= w:
        tmp = h / y * x * h / 2
    else:
        tmp = (w + x) * h / 2
    area.append(min(tmp, a - tmp))

if h - y != 0:
    if h / (h - y) * x <= w:
        tmp = h / (h - y) * x * h / 2
    else:
        tmp = (w + (w - x)) * h / 2
    area.append(min(tmp, a - tmp))

if x != 0:
    if w / x * y <= h:
        tmp = w / x  * y * w / 2
    else:
        tmp = (h + y) * w / 2
    area.append(min(tmp, a - tmp))
if w - x != 0:
    if w / (w - x) * y <= h:
        tmp = w / (w - x) * y * w / 2
    else:
        tmp = (2 * h - y) * w / 2
        area.append(min(tmp, a - tmp))

ans_c = collections.Counter(area)
ans_c = list(ans_c.items())

ans_c.sort(key=lambda x: x[0], reverse=True)
size = ans_c[0][0]
a = 0
if ans_c[0][1] > 1:
    a = 1

print("{} {}".format(size, a))

Submission status: Wrong Answer

Solution code:
a = input().split()
w = int(a[0])
h = int(a[1])
x = int(a[2])
y = int(a[3])

def main():
    mx = w - x    
    my = h - y
    m1 = mx*h
    m2 = my*w
    m3 = x * h
    m4 = y * w
    minv1 = min([m1,m3])
    minv2 = min([m2,m4])
    res = max((minv2, minv1))
    if minv2 != minv1:
        res2 = 0
    else:
        res2 = 1
    print(res, res2)



if __name__ == '__main__':
    main()