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:
#!/usr/bin/env python3
import sys


def solve(W: int, H: int, x: int, y: int):
    # ans1 = max(min((W-x)*H, x*H),min(W*(H-y), W*y))
    if((x == 0 and y == 0) or (x == 0 and y == W) or (x == W and y == 0) or (x == W and y == H)):
        ans1 = H*W/2
    else:
        ans1 = max(min((W-x)*H, x*H),min(W*(H-y), W*y))

    if((y == H/2) and (x == W/2)):
        ans2 = 1
    else:
        ans2 = 0

    print(ans1,ans2)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)

if __name__ == '__main__':
    main()

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 or (x,y)==(0,0) or (x,y)==(0,H) or (x,y)==(W,0) or (x,y)==(W,H)):
		area = total_area/2
	if(x/W == y/H or x/W == (y-H)/-H):
		area = total_area/2
	if(W==H and x==y):
		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 inpl(): return list(map(int, input().split()))
W, H, x, y = inpl()
if x > W/2:
    x = W-x
if y > H/2:
    y = H-y

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

Submission status: Wrong Answer

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

if x == W/2 and y == H/2:
    judge = 1
elif y == (-H*x)/W + H or y == H*x / W:
    judge = 0
elif x == W/2 or y == H/2:
    judge = 0
else:
    judge = 1

ans = W*H / 2

print("{0:.6f}".format(ans), judge)

Submission status: Wrong Answer

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

ans = 0
anscnt = 0
if W - x == x and H - y == y:
    ans = (W * H) / 2
    anscnt = 1
else:
    tmp1 = min(((W - x) * H), (W * H - (W - x) * H))
    tmp2 = min((W * (H - y)), (W * H - (W * (H - y))))
    ans = max(tmp1, tmp2)

print(ans, end=' ')
print(anscnt)

Submission status: Wrong Answer

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

a = max(w, h)
b = min(x, w - x)
s = a * b

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

Submission status: Wrong Answer

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

right_length = W - x
top_length = H -y 

width = min(W - x,x) 
height = min(H - y, y)

S_vertical = H * width
S_horizonal = W * height

flag = 0
if S_vertical == S_horizonal:
    flag = 1
S = max(S_vertical, S_horizonal)
if (x==0)or(y==0)or(x==W)or(y==H): #点が周上
    S = W * H /2
    flag = 0

on_top = (x == 0)

print(S,flag)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(float, input().split())
a1, a2 = (w - x) * h, x * h
A = min(a1, a2)
B = min((h - y) * w, y * w)
res = "0"
if a1 == a2 and A == B and a1 != 0:
        res = "1"
print("{0:.06f}".format(max(A, B)), res)

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:
    print(W*H/2, 0)
else:
    dx1 = x - 0
    dx2 = W - x
    dy1 = y - 0
    dy2 = H - y
    if dx1 == dx2 and dy1 == dy2:
        print("{:.10f}".format(W*H/2), 1)
    elif dx1 == dx2 or dy1 == dy2:
        print("{:.10f}".format(W*H/2), 0)
    else:
        print("{:.10f}".format(W*H/2), 1)

Submission status: Wrong Answer

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

men = W*H
hidari =(x)*H
migi = men-hidari
sita = W*y
ue = men-sita

ans1 = min([hidari,migi])
ans2 = min([ue,sita])


if ans1 == ans2:
  print(ans1, 1)
elif ans1 > ans2:
    print(ans1,0)
elif ans1 < ans2:
    print(ans2,0)


'''
print(men)
print(hidari)
print(migi)
print(ue)
print(sita)
'''

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())
if W == x or H == y or x == y == 0:
    S = W * H * 0.5
    print(S,1)
elif W/2 == x and H/2 == y:
    S = W * H * 0.5
    print(S,1)
else:
    S1 = x * H
    S2 = (W-x) * H
    S3 = W * y
    S4 = W * (H-y)
    print(max([min([S1,S2]),min([S3,S4])]),0)

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.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 y > H/2:
        yokomax = W * (H-y)
    elif y < H/2:
        yokomax = W * (y)
    elif y == H/2:
        yokomax = W * y
    if x > W/2:
        tatemax = H * (W-x)
    elif x < W/2:
        tatemax = H *x
    elif x == W/2:
        tatemax = H * x
if yokomax == tatemax: 
    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print('{:.12e}'.format(max(yokomax,tatemax)),'0')

Submission status: Wrong Answer

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

#正方形の場合
if W == H:
    #座標が真ん中の場合
    if W//2 == x and H//2 == y:
        print(W*H/2, 1, sep=' ')
    #座標がよってるとき
    else:
        if x > W-x:
            print((W-x)*H, 1, sep=' ')
        else:
            print(x*H, 1, sep=' ')
else:
    if W//2 == x and H//2 == y:
        print(W*H/2, 1, sep=' ')
    else:
        if x > W-x:
            print((W-x)*H, 0, sep=' ')
        else:
            print(x*H,0, sep=' ')

Submission status: Wrong Answer

Solution code:
import sys

w, h, x, y = input().split()
w = float(w)
h = float(h)
x = float(x)
y = float(y)

if w/2==x and h/2==y:
  print(w*h/2, 1)
elif h>=x:
  s=min(w*h-x*h, x*h)
  print(s,0)
else:
  s=min(w*h-y*w, y*w)
  print(s,0)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

if x == W and y == H:
    print(W * H / 2, 0)
elif x == 0 and y == 0:
    print(W * H / 2, 0)
elif x == W or x == 0:
    print(min(y, H - y) * x / 2, 0)
elif y == H or y == 0:
    print(min(x, W - x) * y / 2, 0)
else:
    horizon = min((x * H), (W - x) * H)
    vertical = min((y * W), (H - y) * W)
    flag = 0
    if horizon == vertical:
        flag = 1
    print(max(horizon, vertical), flag)

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

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

Submission status: Wrong Answer

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

S = W*H
ans1 = S/2
ans2 = 0
if 2*x == W or 2*y == H:
    ans2 = 1
if x == 0 or x == W or y == 0 or y == H:
    ans2 = 0

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())
if W == x or H == y or x == y == 0:
    S = W * H * 0.5
    print(S,0)
elif W/2 == x and H/2 == y:
    S = W * H * 0.5
    print(S,1)
else:
    S1 = x * H
    S2 = (W-x) * H
    S3 = W * y
    S4 = W * (H-y)
    print(max([min([S1,S2]),min([S3,S4])]),1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

o1 = (w * h) / 2

l = []
a = h / w

for i in range(h+1):
  if (h * i) % w is 0:
    l.append((i, h / w * i))
    l.append((i, - h / w * i + h))
if (x, y) in l:
  o2 = 1
else:
  o2 = 0
  
print(o1, o2)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
def S1(W, H, x, y):
    w = W / 2
    if(x <= w):
        return H * x / 1.000000
    else:
        return H * (W - x) / 1.000000
def S2(W, H, x, y):
    h = H / 2
    if(y <= h):
        return W * y / 1.000000
    else:
        return W * (H - y) / 1.000000

def S3(W, H, x, y):
    return W * H / 2.000000


ans1 = max(S1(W, H, x, y), S2(W, H, x, y), S3(W, H, x, y))
if(W == H):
    ans2 = 1
else:
    ans2 = 0

print(str(ans1) + " " + str(ans2))

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

if x == W and y == H:
    print(W * H / 2, 0)
elif x == 0 and y == 0:
    print(W * H / 2, 0)
elif x == W or x == 0:
    print(max(y, H - y) * x / 2, 0)
elif y == H or y == 0:
    print(max(x, W - x) * y / 2, 0)
else:
    horizon = min((x * H), (W - x) * H)
    vertical = min((y * W), (H - y) * W)
    flag = 0
    if horizon == vertical:
        flag = 1
    print(max(horizon, vertical), flag)

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
	if x_half_point and y_half_point:
		pattern = 1
		S = W * H / 2
	elif x_half_point or y_half_point:
		pattern = 0
		S = W * H / 2	
	else:
		min_x = min(x,W - x)
		min_y = min(y,H - y)
		S = max((min_x * H,min_y * W))
		pattern = 0
print(S,pattern)

Submission status: Wrong Answer

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

men = W*H
hidari =(x)*H
migi = men-hidari
sita = W*y
ue = men-sita

ans1 = min([hidari,migi])
ans2 = min([ue,sita])


if ans1 == ans2:
  print(ans1, 1)
elif ans1 >= ans2:
    print(ans1,0)
elif ans1 <= ans2:
    print(ans2,0)


'''
print(men)
print(hidari)
print(migi)
print(ue)
print(sita)
'''

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans2 = 0

if(x < W/2):
    X = x
else:
    X = W-x

if(W%2 == 0):
    if(x+1 == W-x):
        ans2=1

if(y < H/2):
    Y = y
else:
    Y = H-y
if(H%2 == 0):
    if(y+1 == H-y):
        ans2=1

if(X*H > Y*W):
    ans1 = X*H
elif(X*H == Y*W):
    ans1 = X*H
    ans2 = 1
else:
    ans1 = Y*W

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

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)

else:
    tmpa=x*h
    tmpb=h*w
    print(max(tmpa,tmpb))
    print(0)

Submission status: Wrong Answer

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

if (x == 0 or x == W) and (y == 0 or y == H):
    print("{:.10f} 1".format(W*H/2))
    sys.exit()

x1 = 0.0
x2 = 0.0
if W - x > x:
    x1 = x * H* 1.0
    x2 = (W-x) * H* 1.0
else:
    x1 = (W-x) * H* 1.0
    x2 = x * H* 1.0

y1 = 0.0
y2 = 0.0
if H - y > y:
    y1 = y * W * 1.0
    y2 = (H-y) * W* 1.0
else:
    y1 = (H-y) * W* 1.0
    y2 = y * W* 1.0

if x1 > y1:
    print("{:.10f}".format(x1), end=" ")
else:
    print("{:.10f}".format(y1), end=" ")
if x1 == y1:
    print(1)
else:
    print(0)

Submission status: Wrong Answer

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


def main():
    w, h, x, y = map(int, input().split())
    s = w * h / 2

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(float, input().split())
a1, a2 = (w - x) * h, x * h
A = min(a1, a2)
B = min((h - y) * w, y * w)
res = "0"
if a1 == a2 and A == B:
        res = "1"
print("{0:.06f}".format(max(A, B)), res)

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 / 2 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())
res = w * h / 2
if (w%2==0) and (h%2==0):
    print(res, 1)
else:
    print(res, 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:
    print(W*H/2, 0)
else:
    dx1 = x - 0
    dx2 = W - x
    dy1 = y - 0
    dy2 = H - y
    if dx1 == dx2 and dy1 == dy2:
        print(float("{:.10f}".format(W*H/2)), 1)
    elif dx1 == dx2 or dy1 == dy2:
        print(float("{:.10f}".format(W*H/2)), 0)
    else:
        print(float("{:.10f}".format(W*H/2)), 1)

Submission status: Wrong Answer

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

x1 = w - x
y1 = h - y

s = w * h
s1 = x * h
s2 = x1 * h
s3 = y * w
s4 = y1 * w
ans = 0
if s - s1 >= s1 and s1 > ans:
	ans = s1
if s - s2 >= s2 and s2 > ans:
	ans = s2
if s - s3 >= s3 and s3 > ans:
	ans = s3
if s - s4 >= s4 and s4 > ans:
	ans = s4

cnt = 0

if s1 == ans and s - s1 >= s1:
	cnt += 1
if s2 == ans and s - s2 >= s2:
	cnt += 1
if s3 == ans and s - s3 >= s3:
	cnt += 1
if s4 == ans and s - s4 >= s4:
	cnt += 1

print('{0:.6f}'.format(ans), end=" ")
if (cnt > 1):
	print(1)
else:
	print(0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(int, input().split()))
x1, x2 = (W-x)*H, x*H
y1, y2 = (H-y)*W, y*W
X = min(x1, x2)
Y = min(y1, y2)
result = max(X, Y)

print(result, 1 if X == max(y1, y2) else 0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if x == 0 and y == 0:
    print(W*H, 1)
elif x == W and y == 0:
    print(W*H, 1)
elif x == 0 and y == H:
    print(W*H, 1)
elif x == W and y == H:
    print(W*H, 1)
else:
    # 横分割の時の最小値を求める
    A = min((H-y)*W, y*W)

    # 縦分割の時の最小値を求める
    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
input = sys.stdin.readline

################################################################################

a, b, x, y = map(int, input().split())

if b/a*x < y:
    x, y = a-x, b-y

if x == 0 or y == 0:
    print(a*b/2.0, 0)
    exit(0)

areas = [
    min(x, a-x) * b,
    min(y, b-y) * a,
    y/x*a*a*0.5,
]

a, b = b, a
x, y = y, x

if b/a*x < y:
    x, y = a-x, b-y

areas.append(y/x*a*a*0.5)

areas.sort()
print(areas[-1], 1 if areas[-2] == areas[-1] else 0)

Submission status: Wrong Answer

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

#ねむい

ans1 = min(x * H,(W - x) * H)
ans2 = min(y * W,(H - y) * W)

maxw = max(x,W-x)
maxh = max(x,W-x)
minw = min(y,H-y)
minh = min(y,H-y)

def calc(w,h,m2,m3):
    tv = h / w
    ypos = tv * m2
    return ypos * m3 / 2

ans3 = calc(maxw,minh,minw,W)
ans4 = calc(maxh,minw,minh,H)

cnt = 0
ansv = "1"
mx = max(ans1,ans2,ans3,ans4)
l = [ans1,ans2,ans3,ans4]
for i in l:
    if(mx == i):
        cnt += 1

if(cnt < 2):
    ansv = "0"
print(mx,ansv)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(W: int, H: int, x: int, y: int):
    # ans1 = max(min((W-x)*H, x*H),min(W*(H-y), W*y))
    if(x == 0 or x == W or y == 0 or y == H):
        ans1 = H*W/2
    else:
        ans1 = max(min((W-x)*H, x*H),min(W*(H-y), W*y))

    if((y == H/2) and (x == W/2)):
        ans2 = 1
    else:
        ans2 = 0

    print(ans1,ans2)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)

if __name__ == '__main__':
    main()

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(w*h/2,1)
  else:
    if m1<=m2:
      print(w*h/2,0)
    else:
      print(w*h/2,0)

main()

Submission status: Wrong Answer

Solution code:
whxy = [ int(x) for x in input().split(" ")]
zyusinx = whxy[0] / 2
zyusiny = whxy[1] / 2

result2 = '1'
if zyusinx == whxy[2] and zyusiny == whxy[3]:
    result2 = '0'

square = float((whxy[0]*whxy[1]) / 2 )
print(str(square) + ' ' + result2)

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) or (Num[0] == Num[2] and Num[3] == 0) or (Num[1] == Num[3] and Num[2] == 0) or (Num[0] == Num[2] and Num[1] == Num[3]):
    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:
    print(str(float(Result1)) + " 1")
  else:
    print(str(float(Result1)) + " 0")

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(float,input().split()))
#横にラインを引く
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 y > H/2:
        yokomax = W * (H-y)
    elif y < H/2:
        yokomax = W * (y)
    elif y == H/2:
        yokomax = W * y
    if x > W/2:
        tatemax = H * (W-x)
    elif x < W/2:
        tatemax = H *x
    elif x == W/2:
        tatemax = H * x
if yokomax == tatemax: 
    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print('{:.12e}'.format(max(yokomax,tatemax)),'0')

Submission status: Wrong Answer

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

if (W == x or H == y or x == 0 or y == 0):
    res1 = W * H / 2
    res2 = 0
else:
    tate1 = (W - x) * H
    tate2 = x * H 
    tate = min(tate1, tate2)

    yoko1 = W * (H - y)
    yoko2 = W * y
    yoko = min(yoko1, yoko2)

    res1 = max(yoko, tate)
    res2 = int((W / 2 == x) and (H / 2 == y))

print(res1, res2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

o1 = (w * h) / 2

l = []
a = h / w

for i in range(h+1):
  
  l.append((i, h / w * i))
  l.append((i, - h / w * i + h))

if (x, y) in l:
  o2 = 1
else:
  o2 = 0
  
print(o1, o2)

Submission status: Wrong Answer

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

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

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

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) or (Num[0] == Num[2] and Num[3] == 0) or (Num[1] == Num[3] and Num[2] == 0) or (Num[0] == Num[2] and Num[1] == Num[3]):
    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:
    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())
cnt = 0

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

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

print(minseki, cnt)

Submission status: Wrong Answer

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

if x == W and y == H:
	print(W*H/2,end=" ")
	print(0)
elif x == W and y == 0:
	print(W*H/2,end=" ")
	print(0)

elif x == 0 and y == H:
	print(W*H/2,end=" ")
	print(0)
	
elif x == 0 and y == 0:
	print(W*H/2,end=" ")
	print(0)

elif x == W/2 and y == H/2:
	print(W*H/2,end=" ")
	print(1)
elif x == W/2:
	print(W*H/2,end=" ")
	print(0)
	
elif y == H/2:
	print(W*H/2,end=" ")
	print(0)
	
elif x == W:
	print(W*H/2,end=" ")
	print(1)
	
elif x == 0:
	print(W*H/2,end=" ")
	print(1)
	
elif y == H:
	print(W*H/2,end=" ")
	print(1)

elif y == 0:
	print(W*H/2,end=" ")
	print(1)

else:
	print(W*H/2,end=" ")
	print(1)

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
Gx, Gy = W/2, H/2
if Gx < x:
    x = W - x
if Gy < y:
    y = H - y
C = y + (H/W) * x
s1, s2, s3 = x*H, y*W, 0.5*C*C*(W/H)

if x == 0 or x == W and y == 0 or y == H:
    print(0, 1)
else:
    print(max(s1, s2, s3), 1 if s1 == s2 or s2 == s3 or s3 == s1 else 0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

mxvl = w*h/2
distx = x
disty = y
tpx = w-x
tpy = h-y
pob = False
for i in [distx, tpx]:
    for j in [disty, tpy]:
        if i==j and w-i==h-j and i!=0 and j!=0 and w-i!=0 and h-j!=0:
            pob = True
if pob:
    print('{0:.10f}'.format(mxvl), 1)
else:
    print('{0:.10f}'.format(mxvl), 0)

Submission status: Wrong Answer

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

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]

if x == w or x==0:
	if y==0 or y ==h:
		print(0,0)
	else:
		print(0,1)
	exit()
if y==0 or y ==h:
	if x == w or x==0:
		print(0,0)
	else:
		print(0,1)
	exit()

if max(ans1,ans3)<=max(ans2,ans4):
	m = max(ans1,ans3)
	k = ls2.count(m)
else:
	m = max(ans2,ans4)
	k = ls1.count(m)
print(m,1 if k else 0)

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 = areas.count(minArea)
else:
    countArea = areas.count(minArea)

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

Submission status: Wrong Answer

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

S = W*H
ans1 = S/2
ans2 = 0
if 2*x == W or 2*y == H:
    ans2 = 1
print(ans1, ans2)

Submission status: Wrong Answer

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

o1 = (w * h) / 2

l = []
a = h / w

for i in range(h+1):
  l.append((i, w / h * i))
  l.append((i, - h / w * i + h))

if (x, y) in l:
  o2 = 1
else:
  o2 = 0
  
print(o1, o2)

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

import sys

w,h,x,y = [ int(x) for x in sys.stdin.readline().split() ]
wh = w / 2
hh = h / 2
if abs(hh-x)<0.01 and abs(wh-y)<0.01: flag= 1
else: flag= 0
#
print( "{:>.9f} {:>d}".format( (w*h/2),flag ) )

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

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

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

elif W / 2 != x and H / 2 != y:
    flag = '1'
    s = W * H / 2

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

Submission status: Wrong Answer

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

#たてに分割
left = x*h
right = w*h - left
min1 = min(left,right)

down = y*w
up = w*h - down
min2 = min(down,up)

min3 = -1
if x == y:
    min3 = w*h/2
    
t = 0
if min1 == min2 or min1 == min3 or min2 == min3:
    t = 1
print(max(min1,min2,min3),t)

Submission status: Wrong Answer

Solution code:
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(int((W * H) / 2), 0)
    sys.exit()

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