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:
import os, sys, re, math

(W, H, X, Y) = [int(n) for n in input().split()]

v1 = X * H
v2 = (W - X) * H
vmin = min(v1, v2)

h1 = W * Y
h2 = W * (H - Y)
hmin = min(h1, h2)

if X > Y:
    imin = (Y + (W - X)) * (Y + (W - X)) / 2
else:
    imin = (X + (H - Y)) * (X + (H - Y)) / 2

if -X > Y:
    dmin = (X + Y) * (X + Y) / 2
else:
    dmin = ((W - X) + (H - Y)) * ((W - X) + (H - Y)) / 2

mins = [vmin, hmin, imin, dmin]
min_value = max(mins)
min_count = mins.count(min_value)

print('%f %s' % (min_value, min_count - 1))

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

(W, H, X, Y) = [int(n) for n in input().split()]

v1 = X * H
v2 = (W - X) * H
vmin = min(v1, v2)

h1 = W * Y
h2 = W * (H - Y)
hmin = min(h1, h2)

if X > Y:
    imin = (Y + (W - X)) * (Y + (W - X)) / 2
else:
    imin = (X + (H - Y)) * (X + (H - Y)) / 2

if -X > Y:
    dmin = (X + Y) * (X + Y) / 2
else:
    dmin = ((W - X) + (H - Y)) * ((W - X) + (H - Y)) / 2

mins = [vmin, hmin, imin, dmin]
min_value = max(mins)
min_count = mins.count(min_value)

print('%s %s' % (min_value, min_count - 1))

Submission status: Wrong Answer

Solution code:
w, h, x, y = [int(i) for i in input().split()]
ele = []
rate = []
idx = 0
ele.append(sorted([(w - x) * h, x * h]))
ele.append(sorted([(h - y) * w, y * w]))
rate.append(ele[0][0] / sum(ele[0]))
rate.append(ele[1][0] / sum(ele[1]))
if rate[0] < rate[1]:
	idx = 1
ret = str(ele[idx][0])
if rate[0] == rate[1]:
	ret += " 1"
else:
	ret += " 0"
print (ret)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(s) for s in input().split(' ')]
S = W * H // 2
D = 1 if W / 2 == x and H / 2 == y else 0
print('%f %d' % (S, D))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
min_a = min(x * h, (w - x) * h)
min_b = min(y * w, (h - y) * w)
#print(min_a, min_b)

print(max(min_a, min_b))
print("1") if min_a == min_b else print("0")

Submission status: Wrong Answer

Solution code:
def main():
  import fractions
  
  w,h,x,y=map(int,input().split())
  
  if w//2==x and h//2==y:
    print(w*h/2,1)
  else:
    print(w*h/2,0)
  
if __name__=="__main__":
  main()

Submission status: Wrong Answer

Solution code:
def main():
  import fractions
  
  w,h,x,y=map(int,input().split())
  if w==h:
    print(w*h/2,1)
  else:
    print(w*h/2,0)
    
if __name__=="__main__":
  main()

Submission status: Wrong Answer

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

max_area = w*h/2

split = 0
if x==w//2:
    if y==h//2:
        split = 1

print('{} {}'.format(max_area, split))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
a1=[x*h,(w-x)*h]
a2=[(h-y)*w,w*y]
if min(a1)==min(a2):
	print(min(a1),1)
else:
	print(max(min(a1),min(a2)),0)

Submission status: Wrong Answer

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

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

print(max(min(vs), min(hs)), 1 if min(vs) == min(hs) else 0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
w, h, x, y = map(int, input().split())
s1 = (w - x) * h
s2 = w * h - s1
s3 = w * (h - y)
s4 = w * h - s3

res1 = min(s1, s2)
res2 = min(s3, s4)

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

Submission status: Wrong Answer

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

if w == h:
  how = 1
else:
  how = 0
  
print(w*h/2, how)

Submission status: Wrong Answer

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

sep_x = [x*h,(w-x)*h]
sep_y = [w*y,w*(h-y)]

if min(sep_x) < min(sep_y):
    print(min(sep_y),0)
elif min(sep_y) < min(sep_x):
    print(min(sep_x),0)
else:
    print(min(sep_x),1)

Submission status: Wrong Answer

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

if x == int(W / 2) and y == int(H / 2):
    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 & y == H // 2:
    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())

areaX = min(H * x, H * (W - x))
areaY = min(W * y, W * (H - y))

if areaX == areaY:
    print(areaX, 1)
else:
    print(max(areaX, areaY), 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
w,h,x,y=list(map(int,input().split()))
ans=0
x1=max(w-x,x)
y1=max(h-y,y)
if x1<y1:s=x1*h
elif x1>y1:s=w*y1
else:
  s=x1*h
  ans=1
if w*h//2==s:ans=1
print(s,ans)

Submission status: Wrong Answer

Solution code:
w,h,x,y=list(map(int,input().split()))
ans=0
if max(w-x,x)<max(h-y,y):s=max(w-x,x)*h
elif max(w-x,x)>max(h-y,y):s=w*max(h-y,y)
else:
  s=max(w-x,x)*h
  ans=1
print(s,ans)

Submission status: Wrong Answer

Solution code:
w,h,x,y=list(map(int,input().split()))
ans=0
if max(w-x,x)>max(h-y,y):s=max(w-x,x)*h
elif max(w-x,x)<max(h-y,y):s=w*max(h-y,y)
else:
  s=max(w-x,x)*h
  ans=1
print(s,ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = w*h/2

flag = 0

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

Submission status: Wrong Answer

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

s = w*h/2

flag = 0

if w == h:
    flag = 1
    
print(s, flag)

Submission status: Wrong Answer

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

    s1 = min(x * H, (W - x) * H)
    s2 = min(W * y, W * (H - y))
    #print(f's1:{s1}, s2:{s2}')
    ans = max(s1, s2)
    flag = 0
    if W==H and ans == (W * H) // 2: flag = 1
    print(ans, flag)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    s1 = min(x * H, (W - x) * H)
    if s1 == 0: s1 = max(x * H, (W - x) * H)
    s2 = min(W * y, W * (H - y))
    if s2 == 0: s2 = max(W * y, W * (H - y))
    #print(f's1:{s1}, s2:{s2}')
    ans = max(s1, s2)
    flag = 0
    if s1==s2: flag = 1
    print(ans, flag)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    s1 = min(x * H, (W - x) * H)
    s2 = min(W * y, W * (H - y))
    #print(f's1:{s1}, s2:{s2}')
    ans = max(s1, s2)
    flag = 0
    if s1==s2: flag = 1
    print(ans, flag)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
w, h, x, y = list(map(int, input().split()))
# x = aで分割して場合
s_x = min((w - x) * h, x * h)
# y = bで分割した場合
s_y = min((h - y) * w, y * w)
if (s_x == s_y) or (x == w/2) or (y == h/2):
    print(str(s_x) + " " + str(1))
else:
    print(str(max(s_x, s_y)) + " " + str(0))

Submission status: Wrong Answer

Solution code:
w, h, x, y = list(map(int, input().split()))
# x = aで分割して場合
s_x = min((w - x) * h, x * h)
# y = bで分割した場合
s_y = min((h - y) * w, y * w)
if s_x == s_y:
    print(str(s_x) + " " + str(1))
else:
    print(str(max(s_x, s_y)) + " " + str(0))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 2 * x == X and 2 * y == H:
    print((X * H) / 2, 0)
else:
    print((X * H) / 2, 1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,open(0).read().split())
all=W*H
A1=x*H
A2=all-A1
B1=W*y
B2=all-B1

minA=min(A1,A2)
minB=min(B1,B2)
if minA==minB:
    print(minA,1)
else:
    print(max(minA,minB),0)

Submission status: Wrong Answer

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

area = []

a = W/2
if x >= a:
    area.append((W-x)*H)
elif a > x:
    area.append(x*H)
    
b = H/2
if y >= b:
    area.append((H-y)*W)
elif b > y:
    area.append(y*W)
    
ans1 = max(area)
if area.count(ans1) > 1:
    ans2 = 1
else:
    ans2 = 0
    
print(ans1, ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = x * H
b = (W - x)*H
c = W * y
d = W * (H - y)
def f(m ,n):
    if m == 0 or n ==0:
        return 0
    else:
        return min(m,n)

ans = max(f(a,b),f(c,d))
bool = 1
if f(a,b) == f(c,d):
    bool =1
else:
    bool = 0
print(ans, bool)

Submission status: Wrong Answer

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

a = x * H
b = (W - x)*H
c = W * y
d = W * (H - y)
def f(m ,n):
    if m == 0  or n == 0:
        return max(m,n)
    else:
        return min(m,n)

ans = max(f(a,b),f(c,d))
bool = 1
if f(a,b) == f(c,d):
    bool =1
else:
    bool = 0
print(ans, bool)

Submission status: Wrong Answer

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

a = x * H
b = (W - x)*H
c = W * y
d = W * (H - y)

ans = max(min(a,b),min(c,d))
bool = 1
if min(a,b) == min(c,d):
    bool =1
else:
    bool = 0
print(ans, bool)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(float, input().split())
print('{:.10f}'.format((W * H) / 2), end=" ")
print(0) if(x != W / 2 and y != H / 2) else print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if x == (W // 2) and y == (H//2):
        print(H * (W // 2), 1)
        
elif 0 < x < W:
    mini1 = min(H * x, H * (W - x))
    mini2 = min(y * W, (H - y) * W)
    print(max(mini1,mini2), 0)
else:
    if 0 < y < H:
        print(min(y * W, (H - y) * W), 0)
    else:
        print(H*W,1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def can_split(w, h, x, y):
    if x == 0 or y == 0:
        return False
    elif x == w and y == h:
        return False
    else:
        return True


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

if area1 == area2 and can_split(w, h, x, y):
    print(max(area1, area2), 1)
else:
    print(max(area1, area2), 0)

Submission status: Wrong Answer

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

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

if area1 == area2:
    print(max(area1, area2), 1)
else:
    print(max(area1, area2), 0)

Submission status: Wrong Answer

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

area = min(x, w - x) * h

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

Submission status: Wrong Answer

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

print("{:.5f}".format(Decimal(W) * Decimal(H) / Decimal(2)), 1 if x == W//2 and y == H//2 else 0)

Submission status: Wrong Answer

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

area = min(x, w - x) * h

if w == h:
    print(area, 1)
else:
    print(area, 0)

Submission status: Wrong Answer

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

print("{:.5f}".format(W*H/2), 1 if x == W//2 and y == H//2 else 0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,open(0).read().split())
if W/2 == x and H/2 == y:
  print(W*H/2,1)
elif W/2 == x or H/2 == y: 
  print(max(W/2*H,H/2*W),0)
else:
  w2=min(x,W-x)*H
  h2=min(y,H-y)*W
  p= 0 if w2!=h2 else 1
  print(max(w2,h2),p)

Submission status: Wrong Answer

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

possibility = "0"

if x == int(W / 2) and y == int(H / 2):
  possibility = "1"
  
max = str(W * H / 2)

print(max,possibility)

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,open(0).read().split())
if W/2 == x and H/2 == y:
  print(W*H/2,1)
elif W/2 == x or H/2 == y:
  print(max(W/2*H,H/2*W),0)
else:
  w2=min(x,W-x)*H
  h2=min(y,H-y)*W
  print(max(w2,h2),0)

Submission status: Wrong Answer

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


    ans = w * h / 2
    hasDivision = x + x == w and y + y == h

    print(ans, hasDivision)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

# x軸で切る
s1 = (x - 0) * H
s2 = (W - x) * H
sx = min(s1, s2)

# y軸で切る
s3 = W * (y - 0)
s4 = W * (H - y)
sy = min(s3, s4)

if sx == sy:
    s = sx
    w = 1
else:
    s = max(sx, sy)
    w = 0

print(s, w)

Submission status: Wrong Answer

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

#x軸平行
X = min(W*y,W*(H-y))
  #y軸平行
Y = min(x*H, (W-x)*H)
if x*2 == W and y*2 == H:
  print (W*H/2, 1)
elif X == Y:
  print (X, 0)
else:
  print(max(X, Y), 0)

Submission status: Wrong Answer

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

#x軸平行
X = min(W*y,W*(H-y))
  #y軸平行
Y = min(x*H, (W-x)*H)
if x*2 == W and y*2 == H:
  print (W*H/2, 1)
elif X == Y:
  print (X, 1)
else:
  print(max(X, Y), 0)

Submission status: Wrong Answer

Solution code:
import decimal
W, H, x, y = map(int, input().split())
decimal.getcontext().prec = 7
x = decimal.Decimal(x)
y = decimal.Decimal(y)
#x軸平行
X = min(W*y,W*(H-y))
  #y軸平行
Y = min(x*H, (W-x)*H)
if x*2 == W and y*2 == H:
  print (W*H/2, 1)
elif X == Y:
  print (X, 1)
else:
  print("{:.6g}".format(max(X, Y)), 0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
print(W * H / 2, int((0 < x < W)&(0 < y < H)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = W * H // 2

if W / 2 == x and H / 2 == y:
  print("{} {}".format(ans, 1))
else:
  print("{} {}".format(ans, 0))

Submission status: Wrong Answer

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

ans = 0
way = 0

if x == 0 and y == 0:
  ans = 0
  way = 0
elif x == 0:
  if H == y:
    ans = 0
    way = 0
  elif H - y > y:
    ans = W * y
    way = 0
  elif H - y < y:
    ans = W * (H-y)
    way = 0
  elif H - y == y:
    ans = W * (H-y)
    way = 0
elif y == 0:
  if W == x:
    ans = 0
    way = 0
  elif W - x > x:
    ans = x * H
    way = 0
  elif W - x < x:
    ans = (W-x) * H
    way = 0
  elif W - x == x:
    ans = (W-x) * H
    way = 0
elif x != 0 and y != 0:
  mi = 0

  s = (W-x) * H
  t = x * H

  if s > t:
    mi = t
  else:
    mi = s

  si = 0
  s = W * (H-y)
  t = W * y

  if s > t:
    si = t
  else:
    si = s

  if mi > si:
    ans = mi
    way = 0
  elif mi < si:
    ans = si
    way = 0
  elif mi == si:
    ans = mi
    way = 1

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

Submission status: Wrong Answer

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

ans = 0
way = 0

if x == 0 and y == 0:
  ans = 0
  way = 0
elif x == 0:
  if H == y:
    ans = W*H
    way = 0
  elif H - y > y:
    ans = W * y
    way = 0
  elif H - y < y:
    ans = W * (H-y)
    way = 0
  elif H - y == y:
    ans = W * (H-y)
    way = 0
elif y == 0:
  if W == x:
    ans = W*H
    way = 0
  elif W - x > x:
    ans = x * H
    way = 0
  elif W - x < x:
    ans = (W-x) * H
    way = 0
  elif W - x == x:
    ans = (W-x) * H
    way = 0
elif x != 0 and y != 0:
  mi = 0

  s = (W-x) * H
  t = x * H

  if s > t:
    mi = t
  else:
    mi = s

  si = 0
  s = W * (H-y)
  t = W * y

  if s > t:
    si = t
  else:
    si = s

  if mi > si:
    ans = mi
    way = 0
  elif mi < si:
    ans = si
    way = 0
  elif mi == si:
    ans = mi
    way = 1

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

Submission status: Wrong Answer

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

ans = 0
way = 0

if x == 0 and y == 0:
  ans = W*H
  way = 0
elif x == 0:
  if H == y:
    ans = W*H
    way = 0
  elif H - y > y:
    ans = W * y
    way = 0
  elif H - y < y:
    ans = W * (H-y)
    way = 0
  elif H - y == y:
    ans = W * (H-y)
    way = 0
elif y == 0:
  if W == x:
    ans = W*H
    way = 0
  elif W - x > x:
    ans = x * H
    way = 0
  elif W - x < x:
    ans = (W-x) * H
    way = 0
  elif W - x == x:
    ans = (W-x) * H
    way = 0
elif x != 0 and y != 0:
  mi = 0

  s = (W-x) * H
  t = x * H

  if s > t:
    mi = t
  else:
    mi = s

  si = 0
  s = W * (H-y)
  t = W * y

  if s > t:
    si = t
  else:
    si = s

  if mi > si:
    ans = mi
    way = 0
  elif mi < si:
    ans = si
    way = 0
  elif mi == si:
    ans = mi
    way = 1

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

S = W*H/2
flag = 0

if W==H and x==W/2 and y==W/2:
    flag = 1
    
print(S, flag)

Submission status: Wrong Answer

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

w2=w//2
h2=h//2

if x>w2:
   w3=w-x
else:
   w3=x
s1=h*w3
    
if y>=h2:
   h3=h-y
else:
   h3=y
s2=w*h3

#err1=(s1-s2)/s1

#print("1",w3,h3,s1,s2,err1)

#if -1.0*10**(-9)<err1 and err1<1.0*10**(-9):
if  s1==s2:
    print(s1,1)
elif s1>s2:
    print(s1,0)
else:
    print(s2,0)

Submission status: Wrong Answer

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

w2=w//2
h2=h//2

if x<=w2:
   w3=w-x
else:
   w3=x
s1=h*w3
    
if y<=h2:
   h3=h-y
else:
   h3=y
s2=w*h2

err1=(s1-s2)/s1

#print("1",w2,h2,s1,s2,err1)

if -1.0*10**(-9)<err1 and err1<1.0*10**(-9):
    print(s1,1)
elif s1>s2:
    print(s1,0)
else:
    print(s2,0)

Submission status: Wrong Answer

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

if x==w or x==0:
    if y==h or y==0:
        print(0,"1")
else:
    w2=w//2
    h2=h//2

    s1=h*w2
    s2=w*h2
    err1=(s1-s2)/s1
    if -1.0*10**(-9)<err1<1.0*10**(-9):
        print(s1,"1")
    elif s1>s2:
        print(s1,"0")
    else:
        print(s2,"0")

Submission status: Wrong Answer

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

if x==w or x==0:
    if y==h or y==0:
        print(0,"0")
else:
    w2=int(w//2)
    h2=int(h//2)

    s1=h*w2
    s2=w*h2
    if s1>s2:
        print(s1,"0")
    elif s1==s2:
        print(s1,"1")
    else:
        print(s2,"0")

Submission status: Wrong Answer

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

if x==w or x==0:
    if y==h or y==0:
        print(0,"1")
else:
    w2=int(w//2)
    h2=int(h//2)

    s1=h*w2
    s2=w*h2
    if s1>s2:
        print(s1,"0")
    elif s1==s2:
        print(s1,"1")
    else:
        print(s2,"0")

Submission status: Wrong Answer

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

if x==w or x==0:
    if y==h or y==0:
        print(0,"1")
else:
    w2=w//2
    h2=h//2

    s1=int(h*w2)
    s2=int(w*h2)
    if s1>s2:
        print(s1,"0")
    elif s1==s2:
        print(s1,"1")
    else:
        print(s2,"0")

Submission status: Wrong Answer

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

if x==w or x==0:
    if y==h or y==0:
        print(0,0)
else:
    w2=w//2
    h2=h//2

    s1=int(h*w2)
    s2=int(w*h2)
    if s1>s2:
        print(s1,0)
    elif s1==s2:
        print(s1,1)
    else:
        print(s2,0)

Submission status: Wrong Answer

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

if x==w or x==0:
    if y==h or y==0:
        print(0.0,0)
else:
    w2=w//2
    h2=h//2

    s1=h*w2
    s2=w*h2
    if s1>s2:
        print(s1,0)
    elif s1==s2:
        print(s1,1)
    else:
        print(s2,0)

Submission status: Wrong Answer

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

w2=w//2
h2=h//2

s1=h*w2
s2=w*h2
if s1>s2:
    print(s1,0)
elif s1==s2:
    print(s1,1)
else:
    print(s2,0)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
S = W*H
s1 = x*H
s2 = y*W
d1 = abs(s1-S//2)
d2 = abs(s2-S//2)
if d1 == d2:
    cnt = 1
else :
    cnt = 0
    
if d1<=d2:
    print(s1,cnt)
elif d1>d2:
    print(s2,cnt)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
S = W*H
s1 = x*H
s2 = y*W
d1 = abs(s1-S/2)
d2 = abs(s2-S/2)
if d1 == d2:
    cnt = 1
else :
    cnt = 0
    
if d1<=d2:
    print(s1,cnt)
elif d1>d2:
    print(s2,cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    H,W,X,Y = cin.mapInt()
    print(float(W) * float(H) * 0.5,"01"[X * 2 == W and Y * 2 == H])
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    H,W,X,Y = cin.mapInt()
    print(float(W * H) * 0.5,"01"[X * 2 == W and Y * 2 == H])
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    H,W,X,Y = cin.mapInt()
    print(float(W * H) * 0.5,"01"[W / 2 == X and H / 2 == Y])
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# 最初に入れておくとinputが早くなる
import sys
input = sys.stdin.readline

W, H, x, y = map(int, input().split())
flag = 0
if (W / 2 == x and H / 2 == y):
    flag = 1

print(min(max(x, W-x)*H, max(y, H-y)*W), flag)

Submission status: Wrong Answer

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

if (W//2 == x and H//2 == y):
    FLAG = 1

answer = (W / 2) * H
print(answer, FLAG)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
mi = lambda : map(int, input().split())

w, h, x, y = mi()

s = w*h

yjiku = max([x*h, s-x*h])
xjiku = max([w*y, s-w*y])

if xjiku >= yjiku:
    if w*y == s-w*y:
        print(*[yjiku, 1])
    else:
        print(*[yjiku, 0])
else:
    if x*h == s-x*h:
        print(*[xjiku, 1])
    else:
        print(*[xjiku, 0])

Submission status: Wrong Answer

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

area = ( W * H ) / 2

'''
b = (H -W + 2*x - 2*y ) / 2

if 0 <= H + x -y -b and H + x - y - b <= H and 0 <= x - y - b and x - y - b <= H:
    if 0 <= W - x + y + b and W -x + y + b <= W and 0 <= y - x + b and y - x + b <= W:
        print(area,1)
    else:
        print(area,0)
else:
    print(area,0)
'''

if W == H :
    print(area,1)
else:
    print(area,0)

Submission status: Wrong Answer

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

area = ( W * H ) / 2

b = (H -W + 2*x - 2*y ) / 2

if 0 <= H + x -y -b and H + x - y - b <= H and 0 <= x - y - b and x - y - b <= H:
    if 0 <= W - x + y + b and W -x + y + b <= W and 0 <= y - x + b and y - x + b <= W:
        print(area,1)
    else:
        print(area,0)
else:
    print(area,0)

Submission status: Wrong Answer

Solution code:
whxy=list(map(int,input().split()))
if whxy[2]==whxy[0]//2 and whxy[3]==whxy[1]//2:
  print(whxy[2]*whxy[3]*2,1)
else:
  print(whxy[0]*whxy[1]/2,0)

Submission status: Wrong Answer

Solution code:
whxy=list(map(int,input().split()))
if whxy[2]==whxy[0]//2 and whxy[3]==whxy[1]//2:
  print(whxy[2]*whxy[3]*2,1)
else:
  print(whxy[0]*whxy[1]//2,0)

Submission status: Wrong Answer

Solution code:
whxy=list(map(int,input().split()))
if whxy[2]==whxy[0]//2 and whxy[3]==whxy[1]//2:
  print(whxy[2]*whxy[3]*2,1)
else:
  print(whxy[2]*whxy[3]*2,0)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
#  W, H, x, y = [2, 3, 1, 2]
#  W, H, x, y = [2, 2, 1, 1]
ans1 = (W - x) * H
ans2 = (W - y) * H
cnt = 1 if ans1 == ans2 else 0
if ans1 > 0 and ans2 > 0:
    print(min(ans1, ans2), cnt)
else:
    print(max(ans1, ans2), 0)

Submission status: Wrong Answer

Solution code:
# import itertools
# import math


def solve(W, H, x, y):
    area = W * H
    half_line_count = 0
    if W == H:
        half_line_count = 1
    return [area / 2, half_line_count]


# N = int(input())
# S = input()
W, H, x, y = map(int, input().split())
# A = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(*solve(W, H, x, y))

Submission status: Wrong Answer

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

rec1=min(x*H,W*H-x*H)
rec2=min(y*W,W*H-y*W)
ans=0
if rec1*rec2==0:
    print(rec1+rec2,0)
else:
    if rec1==rec2:
        ans=1
    print(max(rec1,rec2),ans)