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())
full = W*H
count = 0
if x == (W/2):
    if y == (H/2):
        men = W*H/2
        print(men)
        print(1)
    else:
        men = W*H/2
        print(men)
        print(0)
elif y==(H/2):
    men = W*H/2
    print(men)
    print(0)
elif x ==W:
    Y1 = W*y
    Y2 = W*(H-y)
    Y = [Y1, Y2]
    menseki = max(Y)
    print(menseki)
    print(0)
elif y == H:
    X1 = x*H
    X2 = (W-x)*H
    X = [X1, X2]
    menseki = max(X)
    print(menseki)
    print(0)
else:
    X1 = x*H
    X2 = (W-x)*H
    X = [X1, X2]
    XX = max(X)
    Y1 = W*y
    Y2 = W*(H-y)
    Y = [Y1, Y2]
    YY = max(Y)
    menseki = min(XX, YY)
    print(menseki)
    print(0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(_) for _ in input().split()]
if (2 * x == W) ^ (2 * y == H):
    f = 0
else:
    f = 1

print(W * H / 2, f)

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
if H ==W:
    ans2 =1

print(ans,ans2)

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 or float(x) == float(W)/2.0 or float(y) == float(H)/2.0 :
#    if x !=0 and x != W and y!= 0 and y != H:
#        print('{:.12e}'.format(max(yokomax,tatemax)),'1')
if 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(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 or W * H == 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:
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:
def solve():
    w, h, x, y = map(int, input().split())
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(0, 0)
solve()

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

print("{0} {1} {2} {3}".format(str(w), str(h), str(x), str(y)))

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

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

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

print("{0} {1} {2} {3}".format(str(w), str(h), str(x), str(y)))
print("{0} {1} {2} {3}".format(str(men1), str(men2), str(men3), str(men4)))

out2 = 0

if min(men1, men2) == 0:
    out1 = min(men3, men4)
elif min(men3, men4) == 0:
    out1 = min(men1, men2)
else:
    out1 = max(min(men1, men2), min(men3, men4))

if min(men1, men2) == min(men3, men4):
    out2 = 1

if x == 0 and y ==0:
    out1 = x*y /2
    out2 = 0

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

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):
    tmp=min((w*y),w*h-w*y)
    menseki=max(tmp,w*y)
    judge=0
elif (h/w)>(y/x):
    tmp=min((h*x),w*h-h*x)
    menseki=max(tmp,h*x)
    judge=0

print(menseki,judge)

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(l[1])>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 W/2 == x and H/2 == y:
	S = W*H/2
	print("%f %d" % (S,1))
elif W*y == H*x or H*x + W*y == W*H:
	print("%f %d" % (W*H/2,0))
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:
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 
f=0
if x!=0 and abs((h/w)-(y/x)) < sys.float_info.epsilon:
    #print((w*h)/2,0)
    f=1
elif x!=w and abs((h/w)-y/(w-x))< sys.float_info.epsilon:
    #print((w*h)/2,0)
    f=1
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)
elif f:
    print((w*h)/2,0)
else:
    print(d[1],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 or float(x) == float(W)/2.0 or float(y) == float(H)/2.0 :
    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())

b = W * y 
c = H * x 

m = min(b, c)
print(m)
if [b, c].count(m) == 1:
    print(0)
else:
    print(1)

Submission status: Wrong Answer

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

s1 = (H-y)*W
s2 = (W-x)*H
s3 = x*H
s4 = y*W
result1 = 0
result2 = 0

if s1 < s2:
    result1 = s1
else:
    result1 = s2

if s3 < s4:
    result2 = s3
else:
    result2 = s4

if result1 > result2:
    print(result1,' 0')
elif result2 > result1:
    print(result2,' 0')
else:
    print(result1,' 1')

Submission status: Wrong Answer

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

import math

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    token = lines[0].split(" ")
    w = int(token[0])
    h = int(token[1])
    x = int(token[2])
    y = int(token[3])

    return (w, h, x, y)


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

    left = x
    right = w - x

    above = h - y
    below = y

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

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


    area1 = min(left * h, right * h)
    area2 = min(w * below, w * above)

    area = max(area1, area2)

    duplicate = 0   
    if area1 == area2:
        duplicate = 1

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




def main():
    # 出力

    # print("%s" % solve(*parse_input()))
    solve(*parse_input())


if __name__ == '__main__':

    main()

Submission status: Wrong Answer

Solution code:
W, H, x, y = 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):
    if minseki == (x*H or (W-x)*H) and minseki == (W*y or (H-y)*W):
        cnt += 1

print(minseki, cnt)

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():
    if w != x and h != y:
        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))
        allc = [m1,m2,m3,m4]
        if minv2 != minv1:
            res2 = 0
        else:
            res2 = 1
        print(res, res2)
    else:
        print(w*h/2, 0)



if __name__ == '__main__':
    main()

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 str(case1)==str(case2):
    z=1

else:
    z=0

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

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(x,w-x)*h
  else:
    p = 0
    mens = min(y,h-y)*w
print(mens, p)

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(s)
        print(c)
        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:
def solve():
    w, h, x, y = map(int, input().split())
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(0, 1)
solve()

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())
if w==h:
    c=1
else:
    c=0

a=w-x
b=h-y

s=[]
S1=(x*h)
s.append(S1)
S2=float(y*w)
s.append(S2)
S3=float(a*h)
s.append(S3)
S4=float(b*w)
s.append(S4)
s.sort()
print('{:.6f}'.format(s[1]),c)

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 or W * H == x * H + W * y)
print(ans1, ans2)

Submission status: Wrong Answer

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

def on(W, H, x, y):
    check = 0
    if x == 0:
        if y == 0 or y == H:
            check = 1
    if y == 0:
        if x == W:
            check = 1
    return check

check = on(W, H, x, y)
other = 0
if W == H:
    other = 1
if check == 1:
    other = 0

on_line = 0
if H * x + W * y == H or H * x - W * y == 0:
    on_line = 1
    
if x > W // 2:
    x = W - x
if y > H // 2:
    y = H - y

min_area = max(0, x*H, y*W)
if on_line == 1:
    min_area = max(min_area, 0.5 * W * H)
print(min_area, other)

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 and 0 < y < h:
        if h // 2 == y and w // 2 == x and (y > 0) and (x > 0):
            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())

s = (w*h/2)

if (w/2 == x and h/2 != y) \
or (w/2 != x and 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):
  print(s,0)
else:
  print(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)
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)
  elif x*H == W*(H-y):
    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:


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())
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 and W == H:
    ans = 1
    
print(min(split_y, split_x), ans)

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/2==x and h/2==y:
    print('{:6f}'.format(w*h/2),1)
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:
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

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

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

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

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

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

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

print(ans, ' ', another)

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

Submission status: Wrong Answer

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

if w == x:
    num.append(x*min(h-y, y))
elif w-x > x:
    num.append((w-x) * h)
else:
    num.append(x * h)

if h == y:
    num.append(min(w-x, x) * y)
elif 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 = map(float, input().split())
if W == 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())
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:
if tate == yoko:
    jufuku = 1
kiri = max(tate, yoko)
print(kiri, jufuku)

Submission status: Wrong Answer

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



if (x == W and y == H) or (x == W and y == 0) or (x == 0 and y == H):
    print(W*H/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:
W ,H, x, y=map(float, input().split())
i = 0
#sqA
sqA1 = H * x
sqA2 = H * (W - x)

#sqB
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(sqA1,sqA2))+ ' ' + "1")
elif min(sqA1,sqA2) <= min(sqB1,sqB2):
      if sqB1==sqB2:
        print('{0:.6f}'.format(max(sqB1,sqB2))+ ' ' + "1")
      else:
        print('{0:.6f}'.format(max(sqB1,sqB2))+ ' ' + "0")
elif min(sqA1,sqA2) >= min(sqB1,sqB2):
      if sqA1==sqA2:
        print('{0:.6f}'.format(max(sqA1,sqA2))+ ' ' + "1")
      else:
        print('{0:.6f}'.format(max(sqA1,sqA2))+ ' ' + "0")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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((l[1]))>1:
  a = 1
else :
  a = 0
print(l[1],a)

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 x == W/2 and y == H/2:
    ans1 = area/2
    ans2 = 1


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

Submission status: Wrong Answer

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

S = W*H/2
some = 0
if W == H:
    if x == 0 or x == W or y == 0 or y == H:
        some = 0
    elif W / min(x, W-x) == H / min(y, H-y):
        some = 0
    else:
        some = 1
else:
    if x == W / 2 and y == H / 2:
        some = 1
    elif x == W / 2 or y == H / 2:
        some = 0
    elif x == 0 or x == W or y == 0 or y == H:
        some = 0
    elif W / min(x, W-x) == H / min(y, H-y):
        some = 0
    else:
        some = 1

print(S, some)

Submission status: Wrong Answer

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

# たて割り
p1 = x * H
p2 = (W - x) * H

# 横割
p3 = W * y
p4 = W * (H - y)

min1 = min(p1, p2) if p1 != 0 and p2 != 0 else max(p1, p2)
min2 = min(p3, p4) if p3 != 0 and p4 != 0 else max(p3, p4)

zero = [(0, 0), (W, 0), (W, H), (0, H)]

if (x,y) in zero:
    print(0, '0')
    exit()
    
if min1 == min2:
    print(min1, '1')
elif min1 > min2:
    print(min1, '0')
else:
    print(min2, '0')

Submission status: Wrong Answer

Solution code:
import sys

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

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

    if min(h) < min(v):
        print("{:.6f} {}".format(min(v), "0"))
    elif min(h) == min(v):
        print("{:.6f} {}".format(min(v), "1"))
    else:
        print("{:.6f} {}".format(min(h), "0"))

Submission status: Wrong Answer

Solution code:
import numpy as np
w, h, x, y = map(int, input().split())
t_ans = 0
t = 0
ans = 0
flg = 0
a = 100
ans_flg = 0
p_list = np.arange(0.01, 1000.0, 0.01)
for p in p_list:
  if p != 0:
    t = abs((w - h/p) * h/2)
    t_ans = min(t, w*h-t)
    ans = max(t_ans, ans)

for p in p_list:
  t = abs((w - h/p) * h/2)
  t_ans = min(t, w*h-t)
  a = max(t_ans, a)
  if a == ans:
    ans_flg = 1
    

print(ans, ans_flg)

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 and 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==((H*W)-min(menseki_2,menseki_1)):
    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:
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) + " 1\n")
else:
	stdout.write(str(maximum) + " 0\n")

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
cnt = 0
flag = 0
area_1_x = x * H
area_2_x = (W-x) * H
area_1_y = y * W
area_2_y = (H-y) * W
if area_1_x > area_2_x:
    area_x = area_2_x
else:
    area_x = area_1_x
if area_1_y > area_2_y:
    area_y = area_2_y
else:
    area_y = area_1_y
 
if y == H or y == 0:
        area_y = 0
elif x == W or x == 0:
    area_x == 0

if area_x > area_y:
    m = float(area_x)
    print('{:.6f}'.format(m),"0")
elif area_x == area_y:
    m = float(area_x)
    print('{:.6f}'.format(m),"1")
else:
    m = float(area_y)
    print('{:.6f}'.format(m),"0")

Submission status: Wrong Answer

Solution code:
def solve():
    w, h, x, y = map(float, input().split())
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(0, 1)
solve()

Submission status: Wrong Answer

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

Rectangle = W * H

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

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

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

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

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

# xで分割する場合と, yで分割する場合がある
Rectangle_cuts = []

Rectangle_cuts.append(x*H)
Rectangle_cuts.append((W-x)*H)
Rectangle_cuts.append(W*y)
Rectangle_cuts.append(W*(H-y))

hoge = min(Rectangle_cuts[0], Rectangle_cuts[1])  # xに垂直な線を引いて分割して、小さい方
fuga = min(Rectangle_cuts[2], Rectangle_cuts[3])  # yに垂直な線を引いて分割して、小さい方

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

Submission status: Wrong Answer

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

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 y == h and y == 0:
    n = 0
if x == w and h == 0:
    n = 0
print(s, n)

Submission status: Wrong Answer

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

s1a = x*H
s1b = (W-x)*H
s2a = W*y
s2b = W*(H-y)

d1 = abs(s1a-s1b)
d2 = abs(s2a-s2b)

if d1 == d2:
    print min(s1a,s1b), '1'
elif d1 < d2:
    print min(s1a,s1b), '0'
else:
    print min(s2a,s2b), '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 or f/2 == x or f/2  == 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:
# coding: utf-8
w, h, x, y = list(map(int, input().split()))
if (x == 0 and y == 0) or (x == w and y == 0) or (x == 0 and y == h) or (x == w and y == h):
    sv = w * h / 2
    sh = 0
else:
    sv = min(x, w - x) * h
    sh = w * min(y, h - y)
f = 1 if sv == sh else 0
print("{} {}".format(max(sv, sh), f))

Submission status: Wrong Answer

Solution code:
def solve():
    w, h, x, y = map(float, input().split())
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(0, 0)
solve()