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:
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 = []

        if self.__is_center():
            print(hs, 1)
            return

        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 __is_center(self):
        if self.x * 2 == self.W and self.y * 2 == self.H:
            return True

    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:
import sys
import collections
w,h,x,y = map(int, input().split())

if (x,y) in [(w,0), (0,h), (0,0), (w,h)]:
    print(w*h/2, 0)
    sys.exit()

if x/w+y/h==1 or y*w==h*x:
    if x==w//2 or y==h//2:
        print(w*h/2, 1)
    else:
        print(w*h/2, 0)
    sys.exit()

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

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

Submission status: Wrong Answer

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

point=0

if W-x<H-y:
    W=W-x

elif H-y<W-x:
    H=H-y

else:
    W=x
    H=y
    point+=1
    
area=(W*H)

print(area,point)

Submission status: Wrong Answer

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

j = (bigarea/2.000000)

if j % 2 ==0:
    k = '1'
else:
    k = '0'

print('{:6f} {:}'.format(j,k))

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 and w // 2 == x:
            print(s, 1)
        else:
            print(s, 0)
    else:
        if h == w:
            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())

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

elif x==w/2 and y==h:
    print(w*h/2)
    print(0)

elif x==w and y==h/2:
    print(w*h/2)
    print(0)

elif x==w/2 or y==h/2:
    print(w*h/2)
    print(1)

elif x==w or y==h:
    print(w*h/2)
    print(0)

else:
    tmpa=x*h
    tmpc=(w-x)*h
    tmpb=w*y
    tmpd=w*(h-y)

    print(max(min(tmpa,tmpc),min(tmpb,tmpd)))
    print(1)

Submission status: Wrong Answer

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

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

for i, j in [[0, 0], [W, 0], [0, H], [W, H]]:
    if i == x and j == y:
        ans1 = float(W * H)
        ans2 = 0

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(float, input().split()))
x1, x2 = (W-x)*H, x*H
y1, y2 = (H-y)*W, y*W

minX = min(x1, x2)
minY = min(y1, y2)
result = max(minX, minY)

maxX = max(x1, x2)
maxY = max(y1, y2)
print(result, 1 if minX == maxY or minY == maxX else 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
	print("%f %d" % (max(S1,S2),1))

Submission status: Wrong Answer

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

#case1
a=x*H
b=(W-x)*H

if a>=b:
    case1=b
else:
    case1=a

#case2
c=W*y
d=W*(H-y)

if c>=d:
    case2=d
else:
    case2=c

if case1==case2:
    z=1

else:
    z=0

print("{0:.9f}".format(max(case1,case2)),z)

Submission status: Wrong Answer

Solution code:
W,H,x,y=(float(i) for i in input().split())
Sx=H*min(x,W-x)
Sy=W*min(y,H-y)
hoge=0
if Sx==Sy:
  hoge=1
print(min(Sx,Sy),hoge)

Submission status: Wrong Answer

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

A = W*H

if 2*x == W and 2*y == H:
  print(A//2,end=' ')
  print(1)
  
elif H//W * x == y or H-(H//W)*x == y:
  print(A//2,end=' ')
  print(0)  

elif x == 0 or x == W:
  print(min(H-y,y)*W,end=' ')
  print(0)
  
elif y == 0 or y == H:
  print(min(W-x,x)*H,end=' ')
  print(0)
  
elif W%x == 0 and H%y == 0:
  print(A//2,end=' ')
  print(1)
  
elif W%x == 0 or H%y == 0:
  print(A//2,end=' ')
  print(0)
  
else:
  print(max(min(W-x,x)*H,min(H-y,y)*W),end=' ')
  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

    try:
        if y/x == (H/2) / (W/2):
            print("{0} {1}".format(W * H / 2, 0))
        elif x_area != y_area:
            print("{0} {1}".format(max(x_area, y_area), 0))
        else:
            if x_area == y_area == 0:
                print("{0} {1}".format(W * H / 2, 0))
            else:
                print("{0} {1}".format(x_area, 1))
    except ZeroDivisionError:
        if x_area != y_area:
            print("{0} {1}".format(max(x_area, y_area), 0))
        else:
            if x_area == y_area == 0:
                print("{0} {1}".format(W * H / 2, 0))
            else:
                print("{0} {1}".format(x_area, 1))

Submission status: Wrong Answer

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

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

else:
    v1 = min(x,W-x)*H
    v2 = min(y,H-y)*W
    
    ans = max (v1,v2)
    if v1 == v2:
        ans2 = 1
    else:
        ans2 = 0

print(ans,ans2)

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 y == (h / w) * x or y == (-h * w) * x + h:
    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

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:.6f}'.format(rtn), f)

Submission status: Wrong Answer

Solution code:
w, h, x, y = input().split()
w, h, x, y = int(w), int(h), int(x), int(y)
if (x==0) or (y==0) or (x==w/2) or (y==h/2) or (x==w) or (y==h):
    if (x==w/2) and (y==h/2):
        print(w*h/2, 1)
    else:
        print(w*h/2, 0)
else:
    if (x < w/2) and (y < h/2):
        p = (h-y)/(x-x)
        x_pos = (p*x-y)/p
        print((w-x_pos)*h/2, 0)
    elif (x > w/2) and (y < h/2):
        p = (h-y)/-x
        x_pos = (p*x-y)/p
        print(x_pos*h/2, 0)
    elif (x < w/2) and (y > h/2):
        p = -y/(w-x)
        x_pos = (h-y+p*x)/p
        print((w-x_pos)*h/2, 0)
    elif (x > w/2) and (y > h/2):
        p = y/x
        x_pos = (h-y+p*x)/p
        print(x_pos*h/2, 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(float, input().split()))
x1, x2 = (W-x)*H, x*H
y1, y2 = (H-y)*W, y*W

minX = min(x1, x2)
minY = min(y1, y2)
result = max(minX, minY)

maxX = max(x1, x2)
maxY = max(y1, y2)
print(result, 1 if minX == maxY and minY == maxX else 0)

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

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

Submission status: Wrong Answer

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

if w-x > x:
    num.append((w-x) * h)
else:
    num.append(x * h)

if h-y > y:
    num.append(w * (h-y))
else:
    num.append(w * y)

ans.append('{:.9f}'.format(min(num)))

if len(set(num)) < len(num):
    ans.append(1)
else:
    ans.append(0)

print(*ans, sep=' ')

Submission status: Wrong Answer

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

candidate1 = [x*H, (W-x)*H]
candidate2 = [W*y, W*(H-y)]

if 0 in candidate1:
    min1 = -1
else: min1 = min(candidate1)

if 0 in candidate2:
    min2 = -1
else: min2 = min(candidate2)

max12 = max(min1, min2)

if min1 != min2:
    way = 0
else: way = 1

print(max12, way)

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:
	size = min(x*y, x*(h-y))

elif h == y:
	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 abs(min_size1 - min_size2) < 10**(-10):
		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 = (int(i) for i in input().split())
S1 = 0
S2 = 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:
  print(W*H/2,'0')
elif x == W/2 and y == H/2:
  print(W*H/2,'1')
elif x <= W/2 and y <= H/2:
  S1 = x*H
  S2 = W*y
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')
elif x > W/2 and y <= H/2:
  S1 = (W-x)*H
  S2 = W*y
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')
elif x < W/2 and y > H/2:
  S1 = x*H
  S2 = W*(H-y)
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')
else:
  S1 = (W-x)*H
  S2 = W*(H-y)
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')

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 yokomax == tatemax or (W ==H and x !=0 and x != W and y!= 0 and y != H) :
#    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:
h,w,x,y = map(int,input().split())
t = h*w
hy = h*y
hx = t - hy
wx = w*x
wy = t -wx
l = sorted([hy,hx,wx,wy])
if l.count((max(l)))>1:
  a = 1
else :
  a = 0
print(l[1],a)

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*y and x*h==w*(h-y):
    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 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:
W, H, x, y = map(int,input().split())
ans = 0
flag = "0"
if (W//2==x and H//2==y):
    flag = "1"

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

print(format(ans,'.9f'), flag)

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 and 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(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')
elif menseki == ((H*W)/2) and W/2==x and H/2==y:
    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())
a=w*h
b=x*h
c=y*w
g=0
d=(h-y)*w//2
e=a-d
f=min((a-c),c)
i=min((a-b),b)
if b==c or d==f or d==e or i==f or i==e:
    g=1
if x!=w and y!=h:
    print("{:.9f}".format(max(min(a-max(b,c),max(b,c)),min(a-min(b,c),min(b,c)))),g)
elif x==w or x==0:
    print("{:.9f}".format(f),g)
elif y==h or y==0:
    print("{:.9f}".format(i),g)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(float, input().split())
if W - x != 0 and H - y != 0:
  tate = min([H*x, H*(W-x)])
  yoko = min([y*W, (H-y)*W])


  if abs(tate - yoko) <= 0.1**9:
    chohuku = 1
  else:
    chohuku = 0
  print(str(max([tate, yoko]))+ " " + str(chohuku))
else:
  print(str((H*W)/2) + " " + "0")

Submission status: Wrong Answer

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

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

area = W * H

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

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

ans1 = min1
if min1 < min2:
    ans1 = min2

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


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('{:.10f} {}'.format(ans1,ans2))

Submission status: Wrong Answer

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

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

ans2 = int(x * H == W * y)
for i, j in [[0, 0], [W, 0], [0, H], [W, H]]:
    if i == x and j == y:
        ans2 = 0

print(ans1, ans2)

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:
    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:
import sys
w,h,x,y = map(int, input().split())

if (x,y) in [(w,0), (0,h), (0,0), (w,h)]:
    print(w*h/2, 0)
    sys.exit()

if x/w+y/h==1 or y*w==h*x:
    print(w*h/2, 0)
    sys.exit()

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

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

Submission status: Wrong Answer

Solution code:
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 yokomax == tatemax or (W ==H and x !=0 and x != W and y!= 0 and y != H):
    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())

if W / 2 == x and H / 2 == y:
  print(x*H, 1)
  exit()

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

WH = W*H
xH = x*H
Wy = W*y

ans = []

if xH < Wy:
    ans.append(xH)
    if WH/2 == xH:
        if W == H:
            ans.append(1)
        else:
            ans.append(0)
    else:
        ans.append(1)
else:
    ans.append(Wy)
    if WH / 2 == xH:
        if W == H:
            ans.append(1)
        else:
            ans.append(0)
    else:
        ans.append(1)

print(*ans)

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:
		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):
    menseki=(w*h)/2
    judge=1
elif x==(w/2) or y==(h/2):
    menseki=(w*h)/2
    judge=0
elif x==0 or x==w or y==0 or y==h:
    menseki=(w*h)/2
    judge=0
elif (h/w)==(y/x):
    menseki=(w*h)/2
    judge=0
elif y==-(w/h)*x+w:
    menseki=(w*h)/2
    judge=0
elif (h/w)<(y/x):
    #menseki=min((w*y),w*h-w*y)
    menseki=w*y
    judge=0
elif (h/w)>(y/x):
    #menseki=min((h*x),w*h-h*x)
    menseki=h*x
    judge=0

print(menseki,judge)

Submission status: Wrong Answer

Solution code:
# coding: utf-8# coding: utf-8
W, H, x, y = map(int, input().split())
w = W - x
h = H - y
one = [h*W, y*W]
two = [w*H, x*H]
ans = max(min(one), min(two))
if W == H and w*h == x*y:
    print(ans, 1)
else:
    print(ans, 0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

#round1
A1=max(min(x*H,(W-x)*H), min(y*W,(H-y)*W))

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

print(A1,A2)

Submission status: Wrong Answer

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


ym = min(y, h - y)
xm = min(x, w - x)

s1 = ym * w
s2 = xm * h
s = max(s1, s2)

o = 0
if s1 == s2 or h == w:
    o = 1
print("{:.6f} {}".format(s, o))

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

Submission status: Wrong Answer

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






v1 = W * H - x * H
v2 = W * H - W * y

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

print(a, f)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [W, H, x, y] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    if(W * y == H * x or y * W ==  -H * x + W * H):
        print float(W)/2.0 * H , ans2
        return

    ans = max(min(H - y, y) * W, min(W - x, x) * H)
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 1
    print ans, ans2

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
w, h, x, y = map(int, input().split())
s = w * h
# x = 
s1 = min(x * h, s - x * h)
# y = 
s2 = min(y * w, s - y * w)
# y = (y/x)x
s3 = 0
if x != 0 and y != 0:
    if (y / x) < (h / w):
        s3 = w * ((y / x) * w) / 2
    else:
        s3 = h * (h / (y / x)) / 2

# special
if x == 0 and y == 0:
    s3 = s / 2
elif y == 0:
    s3 = x * h / 2
elif x == 0:
    s3 = x * w / 2

if y == h or x == w:
    s3 = s / 2

ans = max(s1, s2, s3)

ans2 = 0
if (x == w / 2) and (y == h / 2):
    ans2 = 1

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

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*y:
    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 min((w-x)*h,x*h)>min(w*(h-y),w*y):
    print('{:6f}'.format(min((w-x)*h,x*h)),0)
else:
    print('{:6f}'.format(min(w*(h-y),w*y)),0)

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))
W, H, x, y = inpl()
if 2*x > W:
    x = W-x
if 2*y > 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, int(2*y == H))
else:
    print(b, int(2*x == W))

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)))
if (x>0)&(y>0):
    cond = 1 if W/H==x/y else 0
else:
    cond = 1 if min(x*H, (W-x)*H)==min(W*y, W*(H-y)) else 0
print(S, cond)

Submission status: Wrong Answer

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

ans2 = 0
if w == 2*x:
    ans1 = x*h
    if h == 2*y and ans1==y*w:
        ans2 = 1
elif h == 2*y:
    ans1 = y*w
    if w == 2*x and ans1==x*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 w == h:
        ans2 = 1

print(ans1,' ',ans2)

Submission status: Wrong Answer

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

z = [(x, y) for y in range(H + 1) for x in range(W + 1)]


if z in (x, y):
    z.remove((x, y))


v1 = W * H - x * H
v2 = W * H - W * y

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

print(a, f)

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:
	size = min(x*y, x*(h-y))

elif h == y:
	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:
# -*- coding: utf-8 -*-
"""



"""
import sys


def solve(W, H, x, y):
    if y == 0 or x == 0 or y == H or x == W:
        return W*H/2.0, 0

    if x == W/2:
        if y == H/2:
            return W*H/2.0, 1
        return W*H/2.0, 0
    if y == H/2:
        return W*H/2.0, 0

    w1 = x * H
    w2 = (W-x) * H
    ww1 = min(w1, w2)

    w3 = y * W
    w4 = (H-y) * W
    ww2 = min(w3, w4)
    if ww1 == ww2:
        return ww1, 1
    return max(ww1, ww2), 0



def main(args):
    W, H, x, y = map(int, input().split())
    ans = solve(W, H, x, y)
    print(*ans)


if __name__ == '__main__':
    main(sys.argv[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 = []

        if self.__is_center():
            print(float(hs), 1)
            return

        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(float(max(s)), 1)
        else:
            print(float(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 __is_center(self):
        if self.x * 2 == self.W and self.y * 2 == self.H:
            return True

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

P = W * H
d1 = x * H
d2 = (W - x) * H
mi1 = min(d1, d2)
d3 = y * W
d4 = (H - y) * W
mi2 = min(d3, d4)
if mi1 > mi2:
    print(mi1, int(H % 2 == 0 and H // 2 == y))
elif mi1 < mi2:
    print(mi2, int(W % 2 == 0 and W // 2 == x))
else:
    print(mi1, 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:
                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:
import decimal
decimal.getcontext().prec = 9
W,H,x,y = map(int,input().split())
H = decimal.Decimal(H)
W = decimal.Decimal(W)
box_s = H*W

min_x = min(decimal.Decimal(box_s*(x/W)),decimal.Decimal(box_s*((W-x)/W)))
min_y = min(decimal.Decimal(box_s*(y/H)),decimal.Decimal(box_s*((W-y)/H)))
print(max(min_x,min_y))
if min_x == min_y:
  print(1)
else:
  print(0)