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

m1 = float(x * H)
m2 = float(y * W)
multi = 0

if W == H:
    multi = 1

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

Submission status: Wrong Answer

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    W, H, x, y = map(int, input().split())
    xleft, xright = x * H, (W - x) * H
    ydown, yup = W * y, W * (H -y)
    if x == 0 or x == W or y == 0 or y == H:
        print(W * H / 2, 0)
    else:
        print(W * H / 2, 1)
    return

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

area1, area2 = x*h, (w-x)*h
area3, area4 = w*y, w*(h-y)

if area1 > area2:
    area_a = area2
else:
    area_a = area1
if area3 > area4:
    area_b = area4
else:
    area_b = area3
if area_a > area_b:
    output = float(area_a)
elif area_a == area_b:
    output = float(area_a)
    count += 1
else:
    output = float(area_b)

print(str(output) + " " + str(count))

Submission status: Wrong Answer

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

def calculate(W, H, x, y):
	total_area = W*H
	way = 0
	area = 0
	if(x==W/2 or y==H/2):
		area = total_area/2
	if(x==W/2 and y==H/2):
		way = 1
	return area, way

area, way = calculate(W, H, x, y)

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

Submission status: Wrong Answer

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

    multi_split = "0"
    if W > H:
        if x > y:
            area = float(W) * y
        else:
            area = float(W) * (H - y)
    elif W < H:
        if x < y:
            area = float(H) * x
        else:
            area = float(H) * (W - x)
    else:
        multi_split = "1"
        if y < float(W / 2):
            area = float(W) * y
        else:
            area = float(W) * (H - y)
    print("{:.6f} {}".format(area, multi_split))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

if min(size[0]) > min(size[1]):
    if x * 2 == W and y * 2 == H:
        print("{:10f}".format(min(size[0])), 1)
    else:
        print("{:10f}".format(min(size[0])), 0)
else:
    if x * 2 == W and y * 2 == H:
        print("{:10f}".format(min(size[1])), 1)
    else:
        print("{:10f}".format(min(size[1])), 0)

Submission status: Wrong Answer

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

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 and y == 0:
        print("%f %d" % (0.5 * w * h, 1))

    if x == w and y == h:
        print("%f %d" % (0.5 * w * h, 1))


    left = x
    right = w - x

    above = h - y
    below = y

    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:
# 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

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

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

if ans == 2:
    ans = 1
else:
    ans = 0

tate = min((W-x)*H , (x - 0)*H)
yoko = min((H-y)*W , (y - 0)*W)

k = max(tate,yoko)
print(k,ans,sep=" ")

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
if (W-x)*H == (H-y)*W:
	print('{:.6f}'.format((W-x)*H), 1)
elif (W-x)*H < (H-y)*W:
	print('{:.6f}'.format((H-y)*W), 0)
else:
	print('{:.6f}'.format((W-x)*H), 0)

Submission status: Wrong Answer

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

divide_x = (x * H, (W-x) * H)
divide_y = (W * y, W * (H-y))
#max_value = max(min(divide_x), min(divide_y))
if min(divide_x) == min(divide_y):
    is_mullt_ans = 1
else:
     is_mullt_ans = 0

print(W * H / 2, is_mullt_ans)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
flag = 0
if (W-x)*H >= x*H:
        ans1 = x*H
elif (W-x)*H < x*H:
        ans1 = (W-x)*H

if (H-y)*W >= y*W:
        ans2 = y*W
elif (H-y)*W < y*W:
        ans2 = (H-y)*W

if W==x and H==y:
        ans1 = W*H/2
        print(str(ans1) + ' ' + str(flag))
elif ans1 > ans2:
        print(str(ans1) + ' ' + str(flag))
elif ans1 == ans2:
        flag = 1
        print(str(ans1) + ' ' + str(flag))
elif ans1 < ans2:
        print(str(ans2) + ' ' + str(flag))

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)
else:
  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:
def solve():
    w, h, x, y = map(float, input().split())
    if x == 0 and y == 0:
        if h < w:
            print(h / 2, 0)
        elif h == w:
            print(h / 2, 0)
        else:
            print(w / 2, 1)
        return
    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])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
"""考え方
よくわからんけど、縦か横の直線で分割する？
あと原点と(x,y)座標の傾きが1:1の場合、斜めに分割したら最大になるっぽい

"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    # 縦に分割する場合
    ans1 = min(x*H, (W-x)*H)

    # 横に分割する場合
    ans2 = min(W*y, W*(H-y))

    # 斜めに分割する場合
    ans3 = 0
    if x == y:
        ans3 = H*W/2

    ans = max(ans1, ans2, ans3)

    if ans1==ans2 or ans2==ans3 or ans3==ans1:
        is_multi = 1
    else:
        is_multi = 0

    print(ans, is_multi)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
W , H , x , y = map(int,input().split())
if x == 0 or x == W:
	x_on_line = True
else:
	x_on_line = False
if y == 0 or y == H:
	y_on_line = True
else:
	y_on_line = False


if x_on_line or y_on_line:
	pattern = 0
	S = W * H / 2
else:
	if (W / 2) == float(x):
		x_half_point = True
	else:
		x_half_point = False
	if (H / 2) == float(y):
		y_half_point = True
	else:
		y_half_point = False
	x_min = min(x,W - x)
	y_min = min(y,H - y)
	S = max((x_min * H),(y_min * W))
	if S == x_min * H:
		if y_half_point:
			pattern = 1
		else:
			pattern = 0
	else:
		if x_half_point:
			pattern = 1
		else:
			pattern = 0
			
print(S,pattern)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if W == H and x == y and W/2 == x:
    print("{0} {1}".format(W * H / 2, 1))
else:
    x_min = min(x, W - x)
    y_min = min(y, H - y)
    x_area = x_min * H
    y_area = W * y_min
    if x_area == y_area:
        print("{0} {1}".format(x_area, 1))
    else:
        print("{0} {1}".format(max(x_area, y_area), 0))

Submission status: Wrong Answer

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

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

res = min(x*H,(W-x)*H)
res2 = min((H-y)*W,y*W)

res3 = 0
print("{} {}".format(max([res,res2,res3]),is_double))

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
  Num = list(map(int,input().split(" ")))
  Result1 = 0
  Result2 = 0
  
  if Num[2] == 0 and Num[3] == 0:
    Result1 = 0
  else:
    if Num[1] / 2 > Num[3]:
      Mem1 = (Num[0] * Num[3]) / 2
    else:
      Mem1 = (Num[0] * (Num[1]-Num[3]))
    if Num[0] / 2 > Num[2]:
      Mem2 = (Num[1] * Num[2])/2
    else:
      Mem2 = (Num[1] * (Num[0] - Num[2]))
    if Mem1 > Mem2:
      Result1 = Mem1
    else:
      Result1 = Mem2
  
  if Num[2] == Num[0] / 2 and Num[3] == Num[1] / 2 and Result1 != 0:
    print(str(float(Result1)) + " 1")
  else:
    print(str(float(Result1)) + " 0")

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  w,h,x,y=LI()

  a1=x*h
  b1=(w-x)*h

  a2=y*w
  b2=(h-y)*w

  m1=m2=inf

  if a1<=b1:
    m1=a1
  else:
    m1=b1

  if a2<=b2:
    m2=a2
  else:
    m2=b2

  if m1==m2:
    print(m1/1.0,1)
  
  else:
    if m1<=m2:
      print(m2/1.0,0)
    else:
      print(m1/1.0,0)

main()

Submission status: Wrong Answer

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

if w==h and x==y:
    s=1
elif x==w/2 and y==h/2:
    s=1
else:
    s=0


S=w*h/2

print(str(S)+' '+str(s))

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int,input().split())
s = (w*h)/2
if x == int(w/2) and y == int(h/2):
  print("{0:.6f}".format(s), 1)
elif x == 0:
  print("{0:.6f}".format(s), 0)
elif y == 0:
  print("{0:.6f}".format(s), 0)
elif x == w:
  print("{0:.6f}".format(s), 0)
elif y == h:
  print("{0:.6f}".format(s), 0)
else:
  s1 = x*h
  s2 = s*2-s1
  s3 = y*w
  s4 = s*2-s3
  s5 = min(s1,s2)
  s6 = min(s3,s4)
  s7 = max(s5,s6)
  print("{0:.6f}".format(s7), 0)

Submission status: Wrong Answer

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

# 水平 or 垂直
if x==W/2 or y==H/2:
    print(AREA/2,1)
# 辺の上
else:
    print(AREA/2,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 ) \
and not (w/2 == x and h/2 == y) \
and not (w == x and 0 == y) \
and not (0 == x and h == y) \
and not (w == x and h == y) \
and not (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())
a = float(w * abs(h - y))
b = float(w * y)
e = min(a,b)

c = float(abs(w - x) * h)
d = float(h * x)
f = min(c,d)

if e == f:
    print(str(e) + " 1")
else:
    print(str(max(e,f)) + " 0")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

#sqA
sqA = min(H * x, H * (W - x))
#sqB
sqB = min(y * W, (H - y) * W)

#print(sqA)
#print(sqB)

if '{0:.6f}'.format(sqA) == '{0:.6f}'.format(sqB):
   #print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "1")
    print(str(max(sqA,sqB))+ ' ' + "1")
else:
   #print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "0")
    print(str(max(sqA,sqB))+ ' ' + "0")

Submission status: Wrong Answer

Solution code:
from sys import stdin
W,H,x,y = [int(x) for x in stdin.readline().rstrip().split()]
if W == H and x == y:
    print((W*H) / 2,1)
    
elif x == W and y == 0:
    print((W*H)/2,0)
    
elif x == 0 and y == H:
    print((W*H)/2,0)

elif x == W and y == H:
    print((W*H)/2,0)
    
elif x == 0 and y == 0:
    print((W*H)/2,0)
    
else:
    squ1 = min(x,W-x) * float(H)
    squ2 = min(y,H-y) * float(W)
    print(max(squ1,squ2),0)

Submission status: Wrong Answer

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

Rectangle = W * H

if x == W and y == H:
    print(int(Rectangle/2), ' ', 0)
    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 = int(min(Rectangle_cuts[0], Rectangle_cuts[1]))  # xに垂直な線を引いて分割して、小さい方
fuga = int(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())
if (x == 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)
    exit()

mx = min(x, w-x)*h
my = min(y, h-y)*w
if x == 0 or y == 0:
    print(max(mx, my), 0)
else:
    s = w*h/2
    if h/w == y/x:
        if mx == my or my == s or s == mx:
            print(s, 1)
        else:
            print(s, 0)
    elif mx == my:
        print(mx, 1)
    else:
        print(max(mx, my), 0)

Submission status: Wrong Answer

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

# 横分割の時の最小値を求める
if H-y == 0:
    A = W*H
else:
    A = min((H-y)*W, y*W)

# 縦分割の時の最小値を求める
if W-x == 0:
    B = W*H
else:
    B = min((W-x)*H, x*H)

# 最後に最大の方を選ぶ
# このときA=Bなら複数あるということ
if A == B:
    print(A, 1)
else:
    print(max(A, B), 0)

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

if W / 2 == x and H / 2 == y:
    flag = '1'
    s = (W / 2) * H

if W / 2 == x and H / 2 != y:
    flag = '0'
    s = (W / 2) * H

if W / 2 != x and H / 2 == y:
    flag = '0'
    s = W * (H / 2)

if W / 2 != x and H / 2 != y:
    flag = '0'
    if W >= H:
        if W - x >= x:
            s = H * x
        else:
            s = H * (W - x)
    else:
        if H - y >= y:
            s = W * y
        else:
            s = W * (H - y)

print('{} {}'.format(s, flag))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W,H,x,y =map(int ,raw_input().split())
i = 0
#if x*2 == W and y +2 ==H:
 #   i = 1
print float(W*H)/2,i

Submission status: Wrong Answer

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

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

res = min(x*H,(W-x)*H)
res2 = min((H-y)*W,y*W)

res3 = 0
if x==y*W/H or x==(H-y)*W/H:
    res3 = H*W/2

print("{} {}".format(max([res,res2,res3]),is_double))

Submission status: Wrong Answer

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

area = W * H
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:
def main():

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

    else:
        s_11=w*(h-y)
        s_12=w*y
        S1=min([s_11,s_12])
        s_21=h*x
        s_22=h*(w-x)
        S2=min([s_21,s_22])

        if S1==S2:
            S=w*h/2
            print(S,0)
        else:
            S=max([S1,S2])
            print(S,0)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
a=min(w-x,x)
b=min(y,h-y)
ans1=max(a*h,b*w)
if a*h==b*w:
 ans2=1
else:
 ans2=0
print(ans1,ans2)

Submission status: Wrong Answer

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


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

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

    if tate == yoko:
        ans_2 = 1
    else:
        ans_2 = 0
    if float(x) == W/2 or float(y) == H/2:
        ans_2 = 1

print(ans, ans_2)

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(int,input().split()))
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2
if y== 0 or y == H:
    tatemax = W*H/2
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if y >= H/2:
        yokomax = W * (H-y)
    else:
        yokomax = W * (y)
    if x >= W/2:
        tatemax = H * (W-x)
    else:
        tatemax = H * x
if yokomax == tatemax: 
    print(float(max(yokomax,tatemax)),'1')
else:
    print(float(max(yokomax,tatemax)),'0')

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 == (W*H)-menseki_2:
    print("{:.9f}".format(menseki), '1')
elif menseki_2 == (W*H)-menseki_1:
    print("{:.9f}".format(menseki), '1')
else:
    print("{:.9f}".format(menseki), '0')

Submission status: Wrong Answer

Solution code:
import collections
w, h, x, y = map(int, input().split())
area = []
# xの直線
area.append(min(h*x, h*(w-x)))

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

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

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


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

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

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

Submission status: Wrong Answer

Solution code:
all = input().split()
W = int(all[0])
H = int(all[1])
x = int(all[2])
y = int(all[3])

judge = 0

S1_x = W * y
S2_x = W * (H-y)
S1_y = x * H
S2_y = (W-x) * H

if S1_x <= S2_x:
    S_x = S1_x
else:
    S_x = S2_x

if S1_x <= S2_y:
    S_y = S1_y
else:
    S_y = S2_y

if S_x > S_y:
    S = S_x
elif S_x == S_y:
    S = S_x
    judge = 1
else:
    S = S_y

print(float(S), judge)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#c.py
w,h,x,y = map(int,input().split())
if w//2 == x and h//2 == y:
    print(w*h/2,0)
else:
    ans = max(min(w*y,(w*h)-w*y),min(h*x,(w*h)-h*x))
    print(ans,1)

Submission status: Wrong Answer

Solution code:
def main():
    W, H, x, y = map(int, input().split())
    if (W // 2, H // 2) != (x, y):
        print(W * H // 2, 0, end=' ')
    else:
        print(W * H // 2, 1, end=' ')


main()

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
if (w-x)*h==w*(h-y):
    print('{:6f}'.format(min((w-x)*h,x*h)),1)
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 main():
    w,h,x,y = map(int,input().split())
    area = w*h/2
    if w*y == h*x or (w*y)+(h*x) == w*h:
        print(area,1)
    else:
        print(area,0)


main()

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
  Num = list(map(int,input().split(" ")))
  Result1 = 0
  Result2 = 0
  
  if Num[2] == 0 or Num[3] == 0:
    Result1 = 0
  else:
    if Num[1] / 2 > Num[3]:
      Mem1 = (Num[0] * Num[3]) / 2
    else:
      Mem1 = (Num[0] * (Num[1]-Num[3]))
    if Num[0] / 2 > Num[2]:
      Mem2 = (Num[1] * Num[2])/2
    else:
      Mem2 = (Num[1] * (Num[0] - Num[2]))
    if Mem1 > Mem2:
      Result1 = Mem1
    else:
      Result1 = Mem2
  
  if Num[2] == Num[0] / 2 and Num[3] == Num[1] / 2 and Result1 != 0:
    print(str(float(Result1)) + " 1")
  else:
    print(str(float(Result1)) + " 0")

Submission status: Wrong Answer

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

sq = (W * H) / 2

someFlg = 1

tilt = H / W

if x == W / 2:
    someFlg = someFlg + 1
if y == H / 2:
    someFlg = someFlg + 1

someFlg = someFlg % 2


if x == 0 or y == 0 or x == W or y == H:
    someFlg = 0

if y == x * tilt:
    someFlg = 0
if y == H - (x * tilt):
    someFlg = 0

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

print(str(sq) + " " + str(someFlg))

Submission status: Wrong Answer

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

A = [W * y, W * (H - y)]
B = [H * x, H * (W - x)]

if all(a != 0 for a in A) and all(b != 0 for b in B):
    print(float(max(min(A), min(B))), 1 if min(A) == min(B) else 0)
elif any(a == 0 for a in A):
    print(float(min(B)), 0)
else:
    print(float(min(A)), 0)

Submission status: Wrong Answer

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

S = W * H

a = x * H
b = S - a
c = y * W
d = S - c

k = max(a, b)
l = max(c, d)

flag = 0
if k < l:
    s = k
    if s == c or s == d:
        flag = 1
else:
    s = l
    if s == a or s == b:
        flag = 1

if [x, y] == [0, 0] or [x, y] == [0, H] or [x, y] == [W, 0] or [x, y] == [W, H]:
    flag = 0

print(s * 1.0, flag)

Submission status: Wrong Answer

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

xs = [x, W - x, W]
ys = [y, H - y, H]

rects_x = [_x for _x in [W * (H-y), W * y]]
rects_y = [_y for _y in [H * (W-x), H * x]]

print(max(min(rects_x), min(rects_y)), 0 if min(rects_x) != min(rects_y) or (0 in rects_x and 0 in rects_y) else 1)

Submission status: Wrong Answer

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


def solve(w, h, x, y):
    def is_only_one_solution():
        if x == w/2 and y == h/2:
            return 1
        if x == w / 2 or y == h / w or y == h / w * x or y == - h / w * x + h:
            return 0  # Only one
        else:
            return 1  # Something else

    only_one = is_only_one_solution()

    result = "{} {}".format(w*h /2, only_one)
    return result


def main():
    w, h, x, y = input_from_console()
    print(solve(w, h, x, y))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

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)
min2 = min(p3, p4)

if min1 == min2:
    print(min1, '1')
elif min1 > min2:
    print(min1, '0')
else:
    print(min2, '0')

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
Gx, Gy = W/2, H/2
if Gx < x:
    x = W - x
if Gy < y:
    y = H - y
s1, s2 = x*H, y*W
print(max(s1, s2), 0 if s1 != s2 else 1)

Submission status: Wrong Answer

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

if W/2 == x and H/2 == y:
    ans_men = (W * H) / 2
    hen = 1
elif W/2 == x or H/2 == y:
    ans_men = (W * H) / 2
    hen = 0

Submission status: Wrong Answer

Solution code:
def get_has_other_ans(x, y):
  if (x == 0 or y == 0 or x == w or y == h) :
    return 1
  else :
    return 0

w, h, x, y = [int(i) for i in input().split(" ")]
  
square1 = x * h
square2 = x * (h - y)
square3 = (w - x) * h
square4 = (w - x) * (h - y)

max = square1
has_other_ans = 0

if (max < square2):
  max = square2
elif (max == square2) :
  has_other_ans = 1

if (max < square3):
  max = square3
elif (max == square3) :
  has_other_ans = 1
  
if (max < square4):
  max = square4
elif (max == square4) :
  has_other_ans = 1
  
# if (x == y) :
#   has_other_ans = 1
  
print(max, has_other_ans)

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:
    if H % 2 != 0:
        print(mi1, 0)
    else:
        print(mi1, int(H // 2 == y))
elif mi1 < mi2:
    if W % 2 != 0:
        print(mi2, 0)
    else:
        print(mi2, int(W // 2 == x))
else:
    print(mi1, 1)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
Gx, Gy = W/2, H/2
if Gx < x:
    x = W - x
if Gy < y:
    y = H - y
s1, s2 = x*H, y*W
print(s1, s2)
print(max(s1, s2), 0 if s1 != s2 else 1)

Submission status: Wrong Answer

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


if W * y > -H * x + W * H:
    dx = x - (-(H / 2 / W) * (-H + y - W * x / H))
    dy = y - ((W + H / W * y - x) / (H / W + W / H))
    x -= 2 * dx
    y -= 2 * dy


def is_center():
    return x * 2 == W and y * 2 == H


def is_on_axis():
    return not is_center() and any([
        x * 2 == W,
        y * 2 == H,
        W * y == -H * x + W * H,
        W * y == H * x,
    ])


if is_center():
    S = W * H / 2
    T = 1
elif is_on_axis():
    S = W * H / 2
    T = 0
else:
    S = max([
        x * (H ** 2) / (H - y) / 2,
        W * (x * y / (W - x) + y) / 2,
    ])
    T = 0

print(str(S) + " " + str(T))

Submission status: Wrong Answer

Solution code:
import math

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

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

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


print(minseki, cnt)

Submission status: Wrong Answer

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

if x == W/2 or y == H/2:
    check = 0
else:
    check = 1

print(W*H/2, check)

Submission status: Wrong Answer

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

other = 0
if W == H:
    other = 1

on_line = 0
if H * x + W * y == H:
    on_line = 1
    
if x > W // 2:
    x = W - x
if y > H // 2:
    y = H - y
    
min_area = 0
try:
    min_area = max(x*H, y*W)
    if on_line == 1:
        min_area = max(min_area, 0.5 * W * H)
    print(min_area, other)
except:
    pass

Submission status: Wrong Answer

Solution code:
W , H , x , y = map(int,input().split())
if x == 0 or x == W:
	x_on_line = True
else:
	x_on_line = False
if y == 0 or y == H:
	y_on_line = True
else:
	y_on_line = False


if x_on_line or y_on_line:
	if float(x) == W / 2 or float(y) == H / 2:
		pattern = 1
	else:
		pattern = 0
	S = W * H / 2
else:
	if (W / 2) == float(x):
		x_half_point = True
	else:
		x_half_point = False
	if (H / 2) == float(y):
		y_half_point = True
	else:
		y_half_point = False
	x_min = min(x,W - x)
	y_min = min(y,H - y)
	S = max((x_min * H),(y_min * W))
	if S == x_min * H:
		if y_half_point:
			pattern = 1
		else:
			pattern = 0
	else:
		if x_half_point:
			pattern = 1
		else:
			pattern = 0
			
print(S,pattern)

Submission status: Wrong Answer

Solution code:

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

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

if x==0:
    print(y*W, "0")
elif y==0:
    print(x*H, "0")
elif x*H > y*W: 
    print(x*H, "0")
elif x*H < y*W:
    print(y*W, "0")
else:
    print(x*H, "1")

Submission status: Wrong Answer

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

mx = min(x, w-x)*h
my = min(y, h-y)*w
if x == 0 or y == 0:
    print(max(mx, my), 0)
else:
    s = w*h/2
    if h/w == y/x:
        if mx != my != s:
            print(s, 0)
        else:
            print(s, 1)
    elif mx == my:
        print(mx, 1)
    else:
        print(max(mx, my), 0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
w = W/2
h = H/2
if int(w)==x and int(h)==y:
    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())
if x == W/2 and y == H/2:
   print("%f %d" % (W*H/2, 1))
elif x == W/2.0 or y == H/2.0 or y == 1.0*H/W*x or y == H-1.0*H/W*x or y == 0 or y == H or x == 0 or x == W:
  print("%f %d" % (W*H/2, 0))
else:
  print("%f %d" % (W*H/2, 1))

Submission status: Wrong Answer

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

a_x = min(x, W - x)
a_y = min(y, H - y)

if (W < H):
    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
elif (x == 0 and y == 0):
    multi_ans = 1
elif (x == 0 and y == H):
    multi_ans = 1
elif (y == 0 and x == W):
    multi_ans = 1
else:
    multi_ans = 0

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

Submission status: Wrong Answer

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

    multi_split = "0"
    if W > H:
        if x > y:
            area = float(W) * y
        else:
            area = float(W) * (H - y)
    elif W < H:
        if x < y:
            area = float(H) * x
        else:
            area = float(H) * (W - x)
    else:
        multi_split = "1"
        area = float(W) * y
    print("{:.6f} {}".format(area, multi_split))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = max(min(temp1),min(temp2))
if  (W/2 == x and H/2 == y):
    print(W*H/2,1)
elif x == 0 or x == W or y == 0 or y == H:
    print(W*H/2,0)
elif min(temp1) == min(temp2):
    print(ans,1)
else:
    print(ans,0)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
if w-2*x==0:
    print(str(min(float(x*h), float((w-x)*h))),"0")
else:
   print(str(min(float(x*h), float((w-x)*h))),"1")

Submission status: Wrong Answer

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

xs = [x, W - x, W]
ys = [y, H - y, H]

rects_x = [_x for _x in [W * (H-y), W * y] if _x != 0]
rects_y = [_y for _y in [H * (W-x), H * x] if _y != 0]

print(max(min(rects_x), min(rects_y)), 0 if min(rects_x) != min(rects_y) or (len(rects_x) == 1 and len(rects_y) == 1) else 1)