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())
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 W*y == H*x:
  print(float(ver_area),1)
else:
  if ver_area <= hori_area:
    print(float(hori_area),0)
  else:
    print(float(ver_area),0)

Submission status: Wrong Answer

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

S_max = W*H/2
pl = 0
if x==(int(W/2)):
  pl = 1
else:
  pl = 0
  
if y==(int(H/2)):
  pl = 1
else:
  pl = 0
  
print(str(S_max) + " " + str(pl))

Submission status: Wrong Answer

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


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

    if 0 < x < w and 0 < y < h:
        s = w * h / 2

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

        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(int, input().split())
count = 0
area_a = 0
area_b = 0

if (x == 0 and y == 0) or (x == w and y == 0) or (x == w and y == h) or (x == 0 and y == h):
    output = w*h/2

else:
    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())
max=W*H/2
xx=x-W/2
yy=y-H/2
if xx==0 or yy==0:
  check=0
else:
  check=1
  
print(max,check)

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

pattern = 1
if w/2 == x and h/2 == y:
    pattern = 1
elif w/2 == x or h/2 == y:
    pattern = 0

print("{} {}".format(w*h/2, pattern))

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:
	cnt += 1
if s2 == ans:
	cnt += 1
if s3 == ans:
	cnt += 1
if s4 == ans:
	cnt += 1

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
f = "0"
if (W != x and H != y and W != 0 and H != 0) and (W/2 == H/2 or (W-x)/2 == H/2 or x == y):
    f="1"
print(str(W*H/2) + " " + f)

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)
    else:
        yokomax = W * (y)
    if x >= W/2:
        tatemax = H * (W-x)
    else:
        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())

min1 = h * min(x, w-x)
min2 = w * min(y, h-y)

if x==0 or y==0 or x==w or y==h:
  print("{} {}".format(w*h/2,'0'))
else:
  if min1 == min2:
    print("{} {}".format(min1,'1'))
  else:
    if x==w/2 or y==h/2:
      print("{} {}".format(max(min1,min2),'1'))
    else:
      print("{} {}".format(max(min1,min2),'0'))

Submission status: Wrong Answer

Solution code:
def main():
    W, H, x, y = map(int, input().split())
    if (W // 2, H // 2) != (x, y) or (x, y) == (0, 0):
        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, raw_input().split())

if (W-x)*H > (H-y)*W: print str((W-x)*H) + ' 0' 
elif (H-y)*W > (W-x)*H: print str((H-y)*W) + ' 0'
else: print str((W-x)*H) + ' 1'

Submission status: Wrong Answer

Solution code:
# coding: utf-8
W, H, x, y = map(int, input().split())
area = []

square = W*H

i = (H-y) * (W)
j = square - i
area.append(min(i, j))

i = (H) * (W-x)
j = square - i
area.append(min(i, j))

i = (H-y) * (W-x) * 2
j = square - i
area.append(min(i, j))


i = (H-y) * x * 2
j = square - i
area.append(min(i, j))

#print(area)
n = max(area)
if area.count(n) == 1:
    print(n, 0) 
else:
    print(n, 1)

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(W-x == 0 and H-y == 0):
        ans1 = H*W
    elif(W-x == 0):
        ans1 = min(W*(H-y), W*y)
    elif(H-y == 0):
        ans1 = min((W-x)*H, x*H)
    else:
        ans1 = max(min((W-x)*H, x*H),min(W*(H-y), W*y))

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

Submission status: Wrong Answer

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


main()

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(float(s),r)

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 = ((W - x) * H)
    tmp2 = (x * H)
    ans1 = min(tmp1, tmp2)
    tmp3 = (W * (H - y))
    tmp4 = (W * y)
    ans2 = min(tmp3, tmp4)
    ans = max(ans1, ans2)

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

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,1)
	else:
		print(0,0)
	exit()
if y==0 or y ==h:
	if x == w or x==0:
		print(0,1)
	else:
		print(0,0)
	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:
w, h, x, y = map(int, input().split())

num = [0.0] * 3

num[0] = float(min(w * h - x * h, x * h))
num[1] = float(min(w * h - w * y, w * y))
num[2] = -1.0


if x * y != 0:
    a = float(y / x)
    tmp = a * x
    area = x * tmp * 0.5
    if tmp > h:
        tmp = h / a
        area = tmp * y * 0.5

    num[2] = min(w * h - area, area)

cnt = 1
if cnt < num.count(max(num)):
    cnt = num.count(max(num))

if cnt > 1:
    print(max(num), 1)
else:
    print(max(num), 0)

Submission status: Wrong Answer

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

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

b = min(y, h-y)
t = w*b

result = 0

if x == w/2 and y == h/2:
    result = 1

u = 0
if w == x and h == y:
    u = w*h/2
if x == 0 and y == h:
    u = w*h/2
if x == 0 and y == 0:
    u = w*h/2
if x == w and y == 0:
    u = w*h/2
 
v = 0
if x == 0 or x == w or y == 0 or y == h:
    v = h*w/2

c = 0
try:
    if y/x == h/w:
        c = h*w/2
except:
    pass

z = 0
try:
    if y == -h/w*x + h:
        z = h*w/2
except:
    pass

print(max(s,t,u,v,c,z),result)

Submission status: Wrong Answer

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

t = [(H-y) * W, (H * W - (H-y) * W), H * (W-x), H * W - H * (W-x)]
t1 = min(t[0],t[1])
t2 = min(t[2],t[3])

print(max(t1,t2), 1 if t1 == t2 else 0)

Submission status: Wrong Answer

Solution code:

read = input 
rn = lambda :list(map(int, read().split()))
w, h, x, y = rn()
total = w * h
mx = 0

# 0
if w * x + h * y > 0:
    tmp = x * h / 2
else:
    tmp = y * w / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 1
tmp = x * h
mx = max( mx, min(total - tmp, tmp) ) 

# 2
if y * (y - h) - x * ( x - w ) > 0:
    tmp = h * (w - x) / 2
else :
    tmp = w * (h - y) / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 3
tmp = y * w
mx = max( mx, min(total - tmp, tmp) ) 

# 4
if w * y  - h * x> 0:
    tmp = w * (h - y) / 2
else :
    tmp = h * (w - x) / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 5
tmp = x * h
mx = max( mx, min(total - tmp, tmp) ) 

# 6
if y * (y - h) - x * ( x - w ) > 0:
    tmp = w * (h - y) / 2
else :
    tmp = h * x / 2
mx = max( mx, min(total - tmp, tmp) ) 

# 7 
tmp = y * w 
mx = max( mx, min(total - tmp, tmp) ) 

import sys
el = w * h - mx
print(mx, end=' ')
if abs(el - mx ) < sys.float_info.epsilon:
    print(0)
else :
    print(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) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0

if (W < H):
    l = H
    m = a_x
else:
    l = W
    m = a_y
ans = l * m
if (x == W/2 and y == H/2):
    multi_ans = 1
elif (W == H and (x != 0 and y != 0)):
    multi_ans = 1
else:
    multi_ans = 0

if ((W == H) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0

if ((x == 0 and y == 0) or (x == 0 and y == H) or (y == 0 and x == W) or (y == H and x == W)):
    multi_ans = 0
    ans = W * H / 2.0

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
W, H, x, y = map(int, input().split())
area = []

square = W*H

i = (H-y) * (W)
j = square - i
area.append(min(i, j))

i = (H) * (W-x)
j = square - i
area.append(min(i, j))

i = (H-y) * (W-x) * 2
j = square - i
area.append(min(i, j))


i = (H-y) * x * 2
j = square - i
area.append(min(i, j))

print(area)
n = max(area)
if area.count(n) == 1:
    print(n, 0) 
else:
    print(n, 1)

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(y < H/2):
    Y = y
else:
    Y = H-y

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(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())
a=w*h
b=x*h
c=y*w
g=0
if b==c:
    g=1
if x!=w and y!=h:
    print("{:.9f}".format(max(min(a-max(b,c),max(b,c)),min(a-min(b,c),min(b,c)))),g)
elif x==w:
    print("{:.9f}".format(min((a-c),c)),g)
elif y==h:
    print("{:.9f}".format(min((a-b),b)),g)

Submission status: Wrong Answer

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

W_difference = ((W / 2) - x) ** 2
H_difference = ((H / 2) - y) ** 2

another_solution = 0

if W_difference == H_difference:
    another_solution = 1
    area = y * W
elif W_difference > H_difference:
    area = y * W
else:
    area = x * H

print('{:.6f} {}'.format(area, another_solution))

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

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'
    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:
import sys
import math
sys.setrecursionlimit(20000000)

W, H, x, y = map(int, input().split())
eps = 1e-9

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

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

# 最後に最大の方を選ぶ
# このときA=Bなら複数あるということ
if math.fabs(A - B) < eps:
    print(max(A, B), 1)
else:
    print(max(A, B), 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)
    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())
num = []
ans = []

num.append('{:.9f}'.format((w-x) * h))
num.append('{:.9f}'.format(w * (h-y)))

ans.append(max(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 = [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
C = y + (H/W) * x
s1, s2, s3 = x*H, y*W, 0.5*C*C*(W/H)
print(s1, s2, s3)

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())
dif = 0

if W/2 == x and H/2 == y:
    ans_men = (W * H) / 2
    dif = 1
elif W/2 == x or H/2 == y:
    ans_men = (W * H) / 2
else:
    ans_men1 = (W - x) * H
    ans_men2 = x * H
    ans_men3 = (H - y) * W
    ans_men4 = y * W
    Ans_men = [ans_men1, ans_men2, ans_men3, ans_men4]
    Ans_men.sort()
    ans_men = Ans_men[3]

print(ans_men, dif)

Submission status: Wrong Answer

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

if W == H :
    isMultiAnswer = 1

print((W*H/2), isMultiAnswer)

Submission status: Wrong Answer

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

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(men1), str(men2), str(men3), str(men4)))

out1 = max(min(men1, men2), min(men3, men4))
if x != 0 and y != 0 and (h / w) == (y / x):
    out1 = w * h / 2

out2 = 0
if min(men1, men2) == min(men3, men4):
    out2 = 1
if x != 0 and y != 0 and (h / w) == (y / x):
    out2 = 1

if x == 0 or y ==0:
    out1 = w * h
    out2 = 0
if x == 0 and y ==0:
    out2 = 1

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

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(x+1 == W-x):
    ans2=1

if(y < H/2):
    Y = y
else:
    Y = H-y

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

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

if s - s1 >= s1:
	ans = s1
elif s - s2 >= s2:
	ans = s2
elif s - s3 >= s3:
	ans = s3
elif s - s4 >= s4:
	ans = s4

cnt = 0

if s1 == ans:
	cnt += 1
if s2 == ans:
	cnt += 1
if s3 == ans:
	cnt += 1
if s4 == ans:
	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=map(int,input().split())
lst = [(H-y)*W, y*W, H*x, H*(W-x)]
result = 0 if len(set(lst)) >= 2 else 1
print(max(min(lst[0], lst[1]), min(lst[2], lst[3])), result)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
max=W*H/2
xx=x-W/2
yy=y-H/2
if xx==0 or y==0:
  check=0
else:
  check=1
  
print(max,check)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag = '0'
size = 0

if (w==x and h==y) or (x==0 and y==0):
	size = x*y
	flag = '1'
elif w == x and h != y:
	size = min(x*y, x*(h-y))
elif h == y and w != x:
	size = min(x*y, (w-x)*y)
else:
	size1 = x * h
	size2 = (w - x) * h
	size3 = w * x
	size4 = w * (h - y)

	min_size1 = min(size1, size2)
	min_size2 = min(size3, size4)

	if min_size1 == min_size2:
		flag = '1'

	if min_size1 < min_size2:
		size = min_size2
	else:
		size = min_size1

print(size, flag)

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(float, input().split())
a1, a2 = (w - x) * h, x * h
A = min(a1, a2)
B = min((h - y) * w, y * w)
if a1 == a2 and A != B:
    res = "0"
else:
    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 and y == 0) or (x == W and y == H) or (x == W and y == 0) or (x == 0 and y == H):
    print('{:.6f} {}'.format(W * H * 0.5, 0))
else:
    x_list = [H * x, H * (W - x)]
    y_list = [y * W, (H - y) * W]

    x_min = min(x_list)
    y_min = min(y_list)

    if x_min > y_min:
        print('{:.6f} {}'.format(x_min, 0))
    elif x_min < y_min:
        print('{:.6f} {}'.format(y_min, 0))
    elif x_min == y_min:
        print('{:.6f} {}'.format(y_min, 1))

Submission status: Wrong Answer

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

if x > 0 and x < W and y > 0 and y < H:
  rec_1 = W * min(y, H - y)
  rec_2 = H * min(x, W - x)
  ans = max(rec_1, rec_2)
  multi = 0
  if rec_1 == rec_2:
    multi = 1
  if y == H / W * x or y == - H / W * x + H:
    tmp = H * W / 2
    if tmp == ans or x == W / 2:
      multi = 1
    else:
      multi = 0
    ans = tmp
  print("{} {}".format(max(rec_1, rec_2), multi))
else:
  print("{} {}".format(H * W / 2, 0))

Submission status: Wrong Answer

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

print(str(ans) + " " + str(flag))

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


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

    flag = 0    
    result = 0
    if x/W == y/H :
        flag = 1

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

        else:
            result = H * x

    else:
        flag = 0
        if abs(x/W - 0.5) > (abs(y/H - 0.5)):
            result = min(W * (y), W * (H - y))
        else:
            result = min(H * (x), H * (W - x))


    print(float(result),flag)


if __name__ == "__main__":
    main()

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
# if w / 2 is x or h / 2 is y:
#   o2 = 1
# else:
for i in range(h+1):
  l.append((i, w / h * i))
  l.append((i, - h / w * x + h))


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

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

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

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

if x == 0 or y == 0:
    ans = 0


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

k = max(tate,yoko)

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




print(k,ans,sep=" ")

Submission status: Wrong Answer

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

if x == w/2 and y == h/2:
  s = w * h / 2.0
  print(str(s) + ' 1')
elif x == w/2:
  s = w * y
  print(str(s) + ' 0')
elif y == h/2:
  s = h * x
  print(str(s) + ' 0')

else:
  if x > w/2:
    x = w - x
  if y > h/2:
    y = h - y
  
  a = (2*x - w) / (h - 2*y)
  y0 = y - a * x
  x0 = x - y / a
  if y0 > h:
    xh = x + (h - y) / a
    s = (x0 + xh) * h / 2
  elif x0 > w:
    yw = a * (w - x) + y
    s = (y0 + yw) * w / 2
  else:
    s = x0 * y0 / 2
  
  print(str(s) + ' 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(Rectangle/2, ' ', 0)
    exit()

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

if x == W:
    print(min(W*y, W*(H-y)), ' ', 0)
    exit()
if y == H:
    print(min(H*x, H*(W-x)), ' ', 0)
    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())
print(w*h/2)
print('1') if x==y else print('0')

Submission status: Wrong Answer

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

first = (w - x) * h

second = w * (h - y)

if first == second:
    multi = 1

print (format(max(first, second), '.6f'), multi)

Submission status: Wrong Answer

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



"""
import sys


def solve(W, H, x, y):
    if y == 0 or x == 0 or y == H or x == W:
        return W*H/2.0, 0
    w1 = x * H
    w2 = (W-x) * H
    ww1 = min(w1, w2)

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



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


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
if (W / 2) == x or (H / 2) == y:
    flag = 0
elif x > 0 and x < W and y > 0 and y < H:
    flag = 1
else:
    flag = 0
print(str(ans) + " " + str(flag))

Submission status: Wrong Answer

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

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

if ((W == H) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0

if (W < H):
    l = H
    m = a_x
else:
    l = W
    m = a_y
ans = l * m
if (x == W/2 and y == H/2):
    multi_ans = 1
elif (W == H and (x != 0 and y != 0)):
    multi_ans = 1
else:
    multi_ans = 0

if ((W == H) and (x == y or x == H - y)):
    ans = W * H / 2.0
    if (x == W - x and y == H -y):
        multi_ans = 1
    else:
        multi_ans = 0

if ((x == 0 and y == 0) or (x == 0 and y == H) or (y == 0 and x == W) or (y == H and x == W)):
    multi_ans = 1
    ans = W * H / 2.0

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

Submission status: Wrong Answer

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

a = W*H/2
b = 0

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

num = [0.0] * 3

num[0] = float(min(w * h - x * h, x * h))
num[1] = float(min(w * h - w * y, w * y))
num[2] = -1.0


if x * y != 0:
    a = float(y / x)
    tmp = a * x
    area = x * tmp * 0.5
    if tmp > h:
        tmp = h / a
        area = tmp * y * 0.5

    num[2] = min(w * h - area, area)

cnt = 1
for i in range(1, 2):
    if cnt < num.count(num[i]):
        cnt = num.count(num[i])

if cnt > 1:
    print(max(num), 1)
else:
    print(max(num), 0)

Submission status: Wrong Answer

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

if w/2==x and h/2==y:
  result='1'
else:
  result='0'

s=w*h
s1=(w-x)*h
if s-s1<s1:
  s1=s-s1

s2=w*(h-y)
if s-s2<s2:
  s2=s-s2
max_s=0
if s1 <=s2:
  max_s=s2
else:
  max_s=s1

print(str("{0:.9f}".format(max_s))+' '+result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
            pob = True
if pob:
    print(mxvl, 1)
else:
    print(mxvl, 0)

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

main()

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), "1" if min(v) in h else "0"))
    else:
        print("{:.6f} {}".format(min(h), "1" if min(h) in v else "0"))

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

if x == 0 or y == 0:
    ans = 0


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

k = max(tate,yoko)

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




print(k,ans,sep=" ")