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 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:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

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

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
    print("{:.9f}".format(ans), 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())
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 = min(x,w-x)*h
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 = [int(i) for i in input().split()] 

if y-H/W*x<1e-6 or y-(-H/W*x+H)<1e-6:
    area = W*H/2
    if W/2-x<1e-6 and H/2-y<1e-6:
        num=1
    else:
        num=0
# elif (x, y)==(W, 0) or (x, y)==(W, H) or (x, y)==(0, H):
#     area = W*H/2
#     num = 0
else:
    x_u = W-x
    x_d = x

    x_pat = [x_u*H, x_d*H]

    y_u = H-y
    y_d = H-y

    y_pat = [y_u*W, y_u*W]

    if min(x_pat)>min(y_pat):
        area = float(min(x_pat))
    else:
        area = float(min(y_pat))

    if min(x_pat)==min(y_pat):
        num = 1
    else:
        num = 0
    
print(area, num)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
jufuku = 0
naname = -1
if y == H * x / W or y == -H * x / W + H:
    naname = W * H / 2
    jufuku = 1
# 縦
tate = min((W - x) * H, x * H)
# 横
yoko = min(W * (H - y), W * y)
if tate == yoko or tate == naname or yoko == naname:
    jufuku = 1
kiri = max(tate, yoko, naname)
print(kiri, jufuku)

Submission status: Wrong Answer

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

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:
  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:
W,H,x,y = map(float,input().split())
width = max(x, W-x)
height = max(y, H-y)
menseki_1 = width*H
menseki_2 = height*W
menseki = min(menseki_2,menseki_1)
if menseki_1==menseki_2:
    print("{:.9f}".format(menseki), '1')
elif menseki_1<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())

area = W * H
coordinate = [x, y]

if [W, H] == coordinate or [W, 0] == coordinate or [0, H] == coordinate:
    wArea = hArea = (W * H) / 2
else:
    wArea = W * y
    hArea = H * x

wMin = min(wArea, area - wArea)
hMin = min(hArea, area - hArea)
minMax = max(wMin, hMin)

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

print(minMax, way)

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 or y*2 ==H:
  print(float(W*H/2),1)
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 = list(map(float, input().split()))
x1, x2 = (W-x)*H, x*H
y1, y2 = (H-y)*W, y*W
result = max(min(x1, x2), min(y1, y2))

r2 = max(min(x1, x2), max(y1, y2))
pattern = 0
if result == r2:
    pattern = 1

print(result, pattern)

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

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


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())
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 x == W/2 and y<H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
if x>W/2 and y<H/2:
    S1 = (W-x)*H
    S2 = y*W
    l = max(S1,S2)
if x<W/2 and y == H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
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 x<W/2 and y>H/2:
    S1 = x*H
    S2 = (H-y)*W
    l = max(S1,S2)
if x == W/2 and y>H/2:
    S1 = x*H
    S2 = (H-y)*W
    l = max(S1,S2)
if x>W/2 and y>H/2:
    S1 = (W-x)*H
    S2 = (H-y)*W
    l = max(S1,S2)
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 = [int(inp) for inp in input().split()]
print((W * H) / 2)

if 2 * x == W and 2 * y == H: flag = True
elif 2 * x == W or 2 * y == H: flag = False
else: flag = True
print(1 if flag else 0)

Submission status: Wrong Answer

Solution code:
# 2019/06/16
# AtCoder Beginner Contest 130 - C

# Input
w, h, x, y = map(int,input().split())

# Case "|"
lsq = h * x
rsq = h * (w - x)
wk1 = min(lsq, rsq)

# Case "-"
usq = y * w
dsq = (h - y) * w
wk2 = min(usq, dsq)

# Case Equal
if wk1 == wk2:
    ans2 = 1
else:
    ans2 = 0

ans1 = max(wk1, wk2)

if (w == x and h == y) or (x == 0 and y == 0) or (w == x and y == 0) or (x == 0 and h == y):
    ans1 = (w * h) / 2
    ans2 = 0
elif (x == y and h == w):
    ans1 = (w * h) / 2
    ans2 = 1

# elif (h / y) * x == w or (h / y) * (w - x) == w:
#    ans1 = (w * h) / 2
#    ans2 = 0

# Output
print(ans1, ans2)

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 min(one) == min(two):
    print(ans, 1)
else:
    print(ans, 0)

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*h:
        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 = (int(i) for i in input().split())
a1 = w*h/2
a2 = 0
if( x == y and not((x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h))):
    a2=1
print(a1, a2)

Submission status: Wrong Answer

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

s = W*H/2

if W*y==H*x or H*x+W*y==H*W:
    f=1
else:
    f=0

print(s,f)

Submission status: Wrong Answer

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

if W > H:
    W, H, x, y = H, W, y, x

if x in [0, W] or y in [0, H]:
    ans = W * H / 2
    print("{:.10f}".format(ans), 0)
    quit()

x, y = min(x, W - x), min(y, H - y)
a, b = x * H, y * W
ans = max(a, b)
print("{:.10f}".format(ans), int(a == b))

Submission status: Wrong Answer

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

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

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

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

minArea = max(areas)

if minArea == ul:
    if ul == rl:
        countArea = allAreas.count(minArea) - 1
    else:
        countArea = [right, left].count(minArea)
else:
    countArea = [upper, lower].count(minArea)

if countArea > 1:
    bl = 1
else:
    bl = 0
print(minArea, bl)

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):
        # 縦横で分割する
        # 縦
        sv = self.x * self.H
        # 横
        sh = self.y * self.W

        return [sv, sh]


rectangleCutting = RectangleCutting()
rectangleCutting.main()

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 = 0
  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 = min(x,w-x)*h
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(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:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

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/(x-w))< 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:
# 2019/06/16
# AtCoder Beginner Contest 130 - C

# Input
w, h, x, y = map(int,input().split())

# Case "|"
lsq = h * x
rsq = h * (w - x)
wk1 = min(lsq, rsq)

# Case "-"
usq = y * w
dsq = (h - y) * w
wk2 = min(usq, dsq)

# Case Equal
if wk1 == wk2:
    ans2 = 1
else:
    ans2 = 0

ans1 = max(wk1, wk2)

if (w == x and h == y) or (x == 0 and y == 0) or (w == x and y == 0) or (x == 0 and h == y):
    ans1 = (w * h) / 2
    ans2 = 0
elif (x == y and h == w):
    ans1 = (w * h) / 2
    ans2 = 0

# elif (h / y) * x == w or (h / y) * (w - x) == w:
#    ans1 = (w * h) / 2
#    ans2 = 0

# Output
print(ans1, ans2)

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'

	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=list(map(int,input().split()))
a=min(w*y,w*(h-y))
b=min(h*x,h*(w-x))
if a==b:print('{:f}'.format(a/1),'1')
else:print('{:f}'.format(max(a,b)/1),'0')

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 - min_y)
        area_b = (W - x) * (H - min_y)
        areas.append(min([area_a, area_b]))

    if 0 < y < H:
        area_a = (W - min_x) * y
        area_b = (W - min_x) * (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)
    print(min_area, multi_flag)


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("{:.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:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 0)

Submission status: Wrong Answer

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

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, W * y)
    else:
        result = min(H * (x), H * (W - x))


    print(result,flag)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#C問題、間違ってそうだから最後に提出

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

res1 = (w-x)*h
res2 = w*(h-y)

if res1 == res2:
	ans = 1
else:
	ans = 0
print(max(res1,res2),ans)

Submission status: Wrong Answer

Solution code:
W, H, x, y=map(int, input().split())
if (H*x==W*y) and ((x!=W/2)and(y!=H/2)):
    print(max(H*x,W*y),0)
    
elif (x<=W/2)and(y<=W/2):
  if (H*x==W*y):
  	print(max(H*x,W*y),1)
  else:
    print(max(H*x,W*y),0)
    
elif (x<=W/2)and(y>W/2):
  if(H*x==W*(H-y)):
  	print(max(H*x,W*(H-y)),1)
  else:
    print(max(H*x,W*(H-y)),0)
        
elif (x>W/2)and(y<=W/2):
  if(H*(W-x)==W*y):
  	print(max(H*(W-x),W*y),1)
  else:
    print(max(H*(W-x),W*y),0)
        
elif (x>W/2)and(y>W/2):
  if(H*(W-x)==W*(H-y)):
  	print(max(H*(W-x),W*(H-y)),1)
  else:
    print(max(H*(W-x),W*(H-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 yokomax == tatemax or W ==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:
from sys import stdin, stdout

w, h, x, y = [int(x) for x in stdin.readline().rstrip().split()]

counter = 0
maximum = 0
a1 = list()
a2 = list()

a1.append((w - x) * h)
a1.append(x * h)

a2.append((h - y) * w)
a2.append(y * w)

if (a1[0] == a1[1]):
	maximum = a1[0]
	counter += 1

if (a2[0] == a2[1]):
	maximum = max(maximum, a2[0])
	counter += 1

if (counter == 2):
	stdout.write(str(maximum) + ".000000 1\n")
else:
	stdout.write(str(maximum) + ".000000 0\n")

Submission status: Wrong Answer

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

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):
    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())
S = W * H
if x == 0 or x == W or y == 0 or 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 = 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 = 1

print(ans1, ans2)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

#round1
A1=min(x*y+(W-x)/2+(H-y)/2, W*H-(x*y+(W-x)/2+(H-y)/2))

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

print(A1,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")
    elif y == 0 or y == H:
        r1 = x * H / 2
        r2 = (W - x) * H / 2
        print(min(r1, r2), "1" if r1 == r2 else "0")
    elif x == 0 or x == W:
        r1 = y * W / 2
        r2 = (H - y) * W / 2
        print(min(r1, r2), "1" if r1 == r2 else "0")
    else:
        r1 = min(x * H, (W-x) * H)
        r2 = min(y * W, (H-y) * W)
        print(max(r1, r2), "1" if r1 == r2 else "0")
main()

Submission status: Wrong Answer

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

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

    if (x == 0 and y == 0) or (x == 0 and y == H) or (x == W and y == 0) or (x == W and y == H):
        s = W * H / 2
        count = 1
    elif (x == 0 and 2 * y == H) or (x == W and 2 * y == H) or (2 * x == W and y == 0) or (2 * x == W and y == H):
        s = W * H / 2
        count = 1
    else:
        if 2 * x == W:
            s = W * H / 2
            count = 1

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

Submission status: Wrong Answer

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

if W == H and x == W/2 and y == H/2:
    ans2 = area/2
    ans2 = 1



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

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[min(s)] > 1:
            print(float(min(s)), 1)
        else:
            print(float(min(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):
        # 縦横で分割する
        # 縦
        sv = self.x * self.H
        # 横
        sh = self.y * self.W

        return [sv, sh]


rectangleCutting = RectangleCutting()
rectangleCutting.main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def sol(inp=input):
    w,h,x,y=map(int,inp().split())
    s=w*h/2
    m=int(x==w//2 and y==h//2)
    return '{:.1f} {}'.format(s,m)
print(sol())

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 == 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

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

    print(area, 0)

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

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

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 * 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(float, input().split())
SV1 = X * H
SV2 = (W - X) * H
SH1 = W * Y
SH2 = W * (H - Y)
SV = min([SV1, SV2])
SH = min([SH1, SH2])
S = max(SV, SH)
print(S, 1 if SH == SV else 0)

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(float,input().split())
if x == 0 or y == 0 or x == w or y == h:
    print(w*h/2,"0")
elif w-x==w/2 and h-y == h/2:
    print(w*h/2,"1")
else:
    print(min(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())

s = (w*h/2)

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

Submission status: Wrong Answer

Solution code:
from decimal import *
import sys
W, H, x, y = map(int, input().split())
 
area = max(min((W - x) * H, x * H), min((H - y) * W, y * W))
 
num = 0
 
if (x, y) == (0, 0) or (x, y) == (W, H) or (x, y) == (W, 0) or (x, y) == (0, H):
    print(Decimal((W * H) / 2), 0)
    sys.exit()

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

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

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

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")
    elif y == 0 or y == H:
        r1 = x * H / 2
        r2 = (W - x) * H / 2
        print(max(r1, r2), "1" if r1 == r2 else "0")
    elif x == 0 or x == W:
        r1 = y * W / 2
        r2 = (H - y) * W / 2
        print(max(r1, r2), "1" if r1 == r2 else "0")
    else:
        r1 = min(x * H, (W-x) * H)
        r2 = min(y * W, (H-y) * W)
        print(max(r1, r2), "1" if r1 == r2 else "0")
main()