Problem:


Score : 300 points

Problem Statement

There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).
You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.

Constraints

1 \leq W,H \leq 10^9

0\leq x\leq W

0\leq y\leq H

All values in input are integers.

Input

Input is given from Standard Input in the following format:

W H x y

Output

Print the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.

The area printed will be judged correct when its absolute or relative error is at most 10^{-9}.

Sample Input 1

2 3 1 2

Sample Output 1

3.000000 0

The line x=1 gives the optimal cut, and no other line does.

Sample Input 2

2 2 1 1

Sample Output 2

2.000000 1



Sample input:
2 3 1 2


Sample output:
3.000000 0

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
full = W*H
count = 0
if x == (W/2):
    if y == (H/2):
        men = W*H/2
        print(men)
        print(1)
    else:
        men = W*H/2
        print(men)
        print(0)
elif y==(H/2):
    men = W*H/2
    print(men)
    print(0)
elif x ==W:
    Y1 = W*y
    Y2 = W*(H-y)
    Y = [Y1, Y2]
    menseki = max(Y)
    print(menseki)
    print(0)
elif y == H:
    X1 = x*H
    X2 = (W-x)*H
    X = [X1, X2]
    menseki = max(X)
    print(menseki)
    print(0)
else:
    X1 = x*H
    X2 = (W-x)*H
    X = [X1, X2]
    XX = max(X)
    Y1 = W*y
    Y2 = W*(H-y)
    Y = [Y1, Y2]
    YY = max(Y)
    if XX == YY:
        menseki = XX
        print(menseki)
        print(1)
    else:
        menseki = min(XX, YY)
        print(menseki)
        print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#整数＋リスト
w, h, x, y = list(map(int, input().split()))


if (x/w < y/h):
    if (x == 0):
        c = w*h/2
    else:
        c = w*w*y/x/2
else:
    if (y == 0):
        c = w*h/2
    else:
        c = h*h*x/y/2

a = x*h
b = y*w

mmm = w*h

if (a > mmm/2):
    a = mmm - a

if (b > mmm/2):
    b = mmm - b

if (c > mmm/2):
    c = mmm - c

#############
#print(a,b,c)

rtn = max(a,b,c)
f = -1
if (a == rtn):
    f += 1
if (b == rtn):
    f += 1
if (c == rtn):
    f += 1
if (f == 2):
    f = 1

print('{0:.9f}'.format(rtn), f)

Submission status: Wrong Answer

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

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


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

print(ans,i)

Submission status: Wrong Answer

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

S_max = float(W*H/2)
pl = 0

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

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(x) for x in input().split())

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

Submission status: Wrong Answer

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

m1 = x * H
m2 = y * W
m1_ = (W-x) * H
m2_ = W * (H-y)

multi = 0

if min(m1, m2) == m1:
    if m1 == m1_:
        multi += 1
    print("{:.6f} {}".format(m1, multi))
else:
    if m2 == m2_:
        multi += 1
    print("{:.6f} {}".format(m2, multi))

Submission status: Wrong Answer

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

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


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

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

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

Submission status: Wrong Answer

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

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

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

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

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

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int,input().split())
split_num = 0
area = 0
if x == w / 2 and y == h / 2:
    split_num = 1
    area = w * h / 2
elif x < w / 2 and y == h / 2:
    area = max(x * h, w * h / 2)
    if area == w * h / 2:
        split_num = 1
elif x > w / 2 and y == h / 2:
    area = max((w - x) * h, w * h / 2)
    if area == w * h / 2:
        split_num = 1
elif x == w / 2 and y < h / 2:
    area = max(y * w, w * h / 2)
    if area == w * h / 2:
        split_num = 1
elif x == w / 2 and y > h / 2:
    area = max((h - y) * w, w * h / 2)
    if area == w * h / 2:
        split_num = 1
elif x < w / 2 and y < h / 2:
    area = max(x * h, y * w)
    if x * h == y * w:
        split_num = 1
elif x < w / 2 and y > h / 2:
    area = max(x * h, (h - y) * 2)
    if x * h == (h-y) * 2:
        split_num = 1
elif x > w / 2 and y < h / 2:
    area = max((w - x) * h, y * w)
    if (w - x) * h == y * w:
        split_num = 1
elif x > w / 2 and y > h / 2:
    area = max((w - x) * h, (h - y) * w)
    if (w - x) * h == (h - y) * w:
        split_num = 1
print(float(area), end = " ")
print(split_num)

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)
s=0

for i in range(1000000):
  a=i/1000
  if a<=h/w:
    cand=w*(a*w-2*a*x+2*y)/2
    s_cand=min(cand,w*h-cand)
    if s_cand>s:
      s=s_cand
  else:
    cand=h*(h+2*a*x-2*y)/(2*a)
    s_cand=min(cand,w*h-cand)
    if s_cand>s:
      s=s_cand
      
if w/2==x and h/2==y:
  print(w*h/2, 1)
else:
  print(s,0)

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(float,input().split(" "))
s = w * h
a = []

a.append(min(x * h,s - x * h))
a.append(min(w * y,s - w * y))

t = 0
if h/w * x >= y:
    t = s/2 * (((h - ((h/w * x) - y))**2)/h**2)
else:
    t = s/2 * (((h - (y - (h/w * x)))**2)/h**2)
a.append(t)

t = 0
if h - h/w * x >= y:
    t = s/2 * ((((h - h/w * x) - y)**2)/h**2)
else:
    t = s/2 * ((y - ((h - h/w * x))**2)/h**2)
a.append(t)

if a.count(max(a)) > 1:
    print('{:.6f}'.format(max(a)),1)
else:
    print('{:.6f}'.format(max(a)),0)

Submission status: Wrong Answer

Solution code:
def tri(w, h, x, y):
    if x == 0 or y == 0:
        return 0
    t = h * x / y
    if t <= W:
        return H * t / 2
    else:
        return W * (W * y / x) / 2

W, H, x, y = [int(i) for i in input().split()]

s = [tri(W, H, x, y), tri(W, H, W - x, y), tri(W, H, x, H - y), tri(W, H, W - x, H - y),
    H * (x if x < (W / 2) else W - x), W * (y if y < (H / 2) else H - y)]
res = max(s)

print("{:.9g} {}".format(res, 0 if s.count(res) <= 1 else 1))

Submission status: Wrong Answer

Solution code:
W, H, x, y = (int(i) for i in input().split())
area = 0
possible = 0
area1 = x * H
area2 = (W-x) * H
area3 = y * W
area4 = (H-y) * W
if area1 > area2:
    area_v = area2
else:
    area_v = area1
if area3 > area4:
    area_h = area4
else:
    area_h = area3
if area_v == area_h:
    possible = 1
area = max(area_v, area_h)
print(area, possible)

Submission status: Wrong Answer

Solution code:
h,w,x,y = map(int,input().split())
t = h*w
hy = h*y
hx = t - hy
wx = w*x
wy = t -wx
l = sorted([hy,hx])
L = sorted([wx,wy])
a = min(l)
b = min(L)
if a>b:
  print(a,0)
elif a < b :
  print(b,0)
else :
  print(a,1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
w, h, x, y = map(int, input().split())

if x == 0 or y == 0:
    s1 = w * h / 2
    s2 = s1
    f = 0
else:
    s1 = min(x, (w-x)) * h
    s2 = min(y, (h-y)) * w
    f = 1 if s1 == s2 else 0

print("{} {}".format(float(max(s1, s2)), f))

Submission status: Wrong Answer

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

if W/2 == x and H/2 == y:
	S = W*H/2
	print("%f %d" % (S,1))
elif W/2 == x or H/2 == y:
	print("%f %d" % (W*H/2,0))
elif W*y == H*x or H*x + W*y == W*H:
	print("%f %d" % (W*H/2,0))
elif x == 0 or y == 0 or x == W or y == H:
	print("%d 0" % (W*H/2))
else:
	S1 = min(x,W-x) * H
	S2 = min(y,H-y) * W
	if S1 == S2:
		print("%f %d" % (max(S1,S2),1))
	else:
		print("%f %d" % (max(S1,S2),0))

Submission status: Wrong Answer

Solution code:
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 ((y == (W / H) * x or y == H - (H / W) * x)) and (x, y) != (W / 2, H / 2):
    print(W * H / 2, str(0))
    sys.exit()

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

if (3 / 2) * x == W and y == H:
    print(x * H , 1)
    sys.exit()
if (3 / 2) * y == H and x == W:
    print(y * W, 1)
    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 == x or H == y or x == y == 0:
    S = W * H * 0.5
    print(S,0)
if W/2 == x and H/2 == y:
    S = W * H * 0.5
    print(S,1)
else:
    S = W * H * 0.5
    print(S,1)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())
# W,H,x,y = map(int, '2 2 1 1'.split())
# print(x*H, (W-x) * H)
a = x*H if x*H<(W-x) * H else (W-x) * H
# print(W*y, W * (H-y))
b = W*y if W*y<W * (H-y) else W * (H-y)

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

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

if x == y == 0:
    ans = W * H / 2
    print("{:.11f}".format(ans), 0)
    quit()

if x in [0, W] or y in [0, H]:
    ans = W * H / 2
    print("{:.11f}".format(ans), 1)
    quit()

x, y = min(x, W - x), min(y, H - y)
a, b = x * H, y * W
ans = max(a, b)
print("{:.11f}".format(ans), int(a == b))

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
ans1 = W * H / 2
if(ans1 % 2 == 0 or W == H):
    ans2 = 1
else:
    ans2 = 0

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

Submission status: Wrong Answer

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

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

area = W * H

if x < W/2:
    min1 = x * H
else:
    min1 = (W-x) * H

if y < H/2:
    min2 = y * W
else:
    min2 = (H-y) * W

ans1 = min1
if min1 < min2:
    ans1 = min2

ans2 = 0
if min1 == min2:
    ans2 = 1


if (x == 0 and y == 0) or (x == 0 and y == H) or (x == W and y == 0) or (x == W and y == H):
    ans1 = area/2
    ans2 = 0

if x == 0 or y == 0 or x == W or y == H:
    ans = area/2
    ans2 = 0

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [W, H, x, y] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    if(W * y == H * x or y * W ==  (-H * x) + W * H):
        print "%20.15f %d" % (float(H)/2.0 * W , ans2)
        return

    ans = max(min(H - y, y) * W, min(W - x, x) * H)
    print "%20.15f %d" % (ans, ans2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a = input().split()
w = int(a[0])
h = int(a[1])
x = int(a[2])
y = int(a[3])

def main():
    if ( w == x and h == y ) or (x==0 and y==0) or( w == x and y ==  0) or( x == 0 and y == h):
        print(w*h/2, 0)
    else:
        mx = w - x    
        my = h - y
        m1 = mx*h
        m2 = my*w
        m3 = x * h
        m4 = y * w
        minv1 = min([m1,m3])
        minv2 = min([m2,m4])
        res = max((minv2, minv1))
        allc = [m1,m2,m3,m4]
        if minv2 != minv1:
            res2 = 0
        else:
            res2 = 1
        print(res, res2)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if (y == H / W * x or (y == -(H*x/W) + H)):
  if (y == H / 2 or x == W / 2):
    print(H*W / 2, 1)
  else:
    print(H*W / 2, 0)

elif (y == H / 2 or x == W / 2):
  if (y == H / 2 and x == W / 2):
    print(H*W / 2, 1)
  else:
    print(H*W / 2, 0)
    
else:
  if (x*H >= y*W):
    if(W*H - x*H > x*H):
      print(x*H, 0)
    else:
      print(W*H - x*H, 0)
  else:
    if(W*H - y*H >= y*H):
      print(y*H, 0)
    else:
      print(W*H - y*H, 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 ((y == (W / H) * x or y == H - (H / W) * x)) and (x, y) != (W / 2, H / 2):
    print(W * H / 2, str(0))
    sys.exit()

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

if (3 / 2) * x == W and y == H:
    print(x * H , 1)
    sys.exit()
if (3 / 2) + y == H and x == W:
    print(y * W, 1)
    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())
SQs = [0] * 4
ans = 0
another = 0

if x == W / 2 or y == H / 2 or x == y or y == -x + H:
    ans = float(W*H/2)
    if W == H:
        another += 1
        
if x == W/2 and y == H/2:
    another = 1

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

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

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

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

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

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

print(ans, ' ', another)

Submission status: Wrong Answer

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

if w == h and w % 2 == 0:
    if x == w or y == h:
        f = w
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
    else:  
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
elif w == h and w % 2 != 0:
    f = w*h*2/3
    print('{:.6f}'.format(f),end = "")
    print(" " + str(1))
else:
    f = max(w,h)
    if w % 2 != 0 and h % 2 != 0:
        if x == 1 and y == 1:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        elif  x == w and y == h:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        elif x == 1 and y == h:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        elif x == w and y == 1:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        else:
            f = w*h*2/3
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
            
        
    if f/2 -1 == x or f/2 - 1 == y or f/2 == x or f/2  == y:
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
    elif x == 1 and y == 1:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif  x == w and y == h:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif x == 1 and y == h:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif x == w and y == 1:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    else:
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))

Submission status: Wrong Answer

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

if x==(w/2) and y==(h/2):
    menseki=(w*h)/2
    judge=1
elif x==(w/2) or y==(h/2):
    menseki=(w*h)/2
    judge=0
elif x==0 or x==w or y==0 or y==h:
    menseki=(w*h)/2
    judge=0
elif (h/w)==(y/x):
    menseki=(w*h)/2
    judge=0
elif y==-(w/h)*x+w:
    menseki=(w*h)/2
    judge=0
elif (h/w)<(y/x):
    tmp=min((w*y),w*h-w*y)
    menseki=max(tmp,(x/y)*h**2/2)
    judge=0
elif (h/w)>(y/x):
    tmp=min((h*x),w*h-h*x)
    menseki=max(tmp,(y/x)*w**2/2)
    judge=0

print(menseki,judge)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
l = 0
S1 = 0
S2 = 0
sp = 0
ans = 0
J = []
if x<W/2 and y<H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
if x == W/2 and y<H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
if x>W/2 and y<H/2:
    S1 = (W-x)*H
    S2 = y*W
    l = max(S1,S2)
if x<W/2 and y == H/2:
    S1 = x*H
    S2 = y*W
    l = max(S1,S2)
if x == W/2 and y == H/2:
    S1 = x*H
    S2 = y*W
    l = x*H
if x>W/2 and y == H/2:
    S1 = (W-x)*H
    S2 = y*W
    l = max(S1,S2)
if x<W/2 and y>H/2:
    S1 = x*H
    S2 = (H-y)*W
    l = max(S1,S2)
if x == W/2 and y>H/2:
    S1 = x*H
    S2 = (H-y)*W
    l = max(S1,S2)
if x>W/2 and y>H/2:
    S1 = (W-x)*H
    S2 = (H-y)*W
    l = max(S1,S2)
ans = l
J.append(ans)
if S1 == S2:
    sp += 1
if sp >= 1:
    J.append(1)
else:
    J.append(0)
print(J[0],J[1])

Submission status: Wrong Answer

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

if (W==0)or(H==0):
    print(float(0))
    print(1)
else:
    if ((y*W-x*H)/W==float(0))or((y*W+x*H)/W==float(H)):
        print(H*W/2)
        print(1)
    else:
        print(H*W/2)
        print(0)

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

Submission status: Wrong Answer

Solution code:


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

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

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

    elif abs(x/W - 0.5) < (abs(y/H - 0.5)):
        result = min(H * (x), H * (W - x))
    
    else:
        result = min(H * (x), H * (W - x),W * (y), W * (H - y))
        


    print(result,flag)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int,input().split())
ans = [min(x*H, (W-x)*H), min(W*y, W*(H-y))]
if W == x or H == y :
    ans.append(0.5*W*H)
if ans[0] == ans[1] :
    print(min(ans), 1)
else :
    print(min(ans), 0)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [W, H, x, y] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    if(W * y == H * x or y * W ==  (-H * x) + W * H):
        print "%20.15f %d" % (float(H)/2.0 * W , ans2)
        return

    ans = max(min(H - y, y) * W, min(W - x, x) * H)
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0
    print "%20.15f %d" % (ans, ans2)

if __name__ == '__main__':
    main()

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 and (y==0 or y == h):
    print(w*h/2)
    print(0)

elif (x==w or x==0) and y==h/2:
    print(w*h/2)
    print(0)

elif x==w/2 or y==h/2:
    print(w*h/2)
    print(0)

elif x==w or y==h:
    print(w*h/2)
    print(0)

else:
    tmpa=x*h
    tmpc=(w-x)*h
    tmpb=w*y
    tmpd=w*(h-y)

    print(max(min(tmpa,tmpc),min(tmpb,tmpd)))
    print(0)

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)
s=0

for i in range(1000000):
  a=i/100
  if a<=h/w:
    cand=w*(a*w-2*a*x+2*y)/2
    s_cand=min(cand,w*h-cand)
    if s_cand>s:
      s=s_cand
  else:
    cand=h*(h+2*a*x-2*y)/(2*a)
    s_cand=min(cand,w*h-cand)
    if s_cand>s:
      s=s_cand
      
if w/2==x and h/2==y:
  print(w*h/2, 1)
else:
  print(s,0)

Submission status: Wrong Answer

Solution code:
import sys
w,h,x,y=map(int,input().split())
#l=[int(i) for i in input().split()]
a=[y*w,(h-y)*w]
a.sort()
b=[x*h,(w-x)*h]
b.sort()
d=[a[0],b[0]]
d.sort()
#print(a,b,d)
#0,0 x,y 
f=0
if x!=0 and abs((h/w)-(y/x)) < sys.float_info.epsilon:
    #print((w*h)/2,0)
    f=1
elif x!=w and abs((h/w)-y/(w-x))< sys.float_info.epsilon:
    #print((w*h)/2,0)
    f=1

if (x==0 and y==0) or (x==w and y==h) or (x==0 and y==h) or (x==w and y==0):
    print((w*h)/2,0)
elif d[0]==d[1]:
    print(d[1],1)
elif f:
    print((w*h)/2,0)
else:
    print(d[1],0)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
#n = int(input()) 
w,h,x,y = (int(i) for i in input().split())

if w==x and h==y:
    ans1=w*h/2
    ans2=0
elif x==0 and y==0:
    ans1=w*h/2
    ans2=0 
elif x==w and y==0:
    ans1=w*h/2
    ans2=0
elif x==0 and y==h:
    ans1=w*h/2
    ans2=0
    
elif 0 < x < w and y==0:
    ans1=w*h/2
    ans2=0
elif 0 < x < w and y==w:
    ans1=w*h/2
    ans2=0  
elif x==0 and 0<y<h:
    ans1=w*h/2
    ans2=0 
elif x==w and 0<y<h:
    ans1=w*h/2
    ans2=0 

else:
    s1=x*h
    s2=h*w-s1
    minx=min(s1,s2)
    s3=y*h
    s4=h*w-s3
    miny=min(s3,s4)

    ans1=max(minx,miny)
    if minx==miny:
        ans2=1
    else:
        ans2=0
    
print(ans1,ans2)

Submission status: Wrong Answer

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

if x==0 or x==W:
  minx=min(x,W-x)
  minS=minx*H
  print(minS+(W*H-2*minS)/2,0)
elif y==0 or y==H:
  miny=min(y,H-y)
  minS=miny*W
  print(minS+(W*H-2*minS)/2,0)
else:
  S1,S2=H*x,(W-x)*H
  S3,S4=W*y,(H-y)*W

  print(max(min(S1,S2),min(S3,S4)), 1 if min(S1,S2)==min(S3,S4) or x==W//2 or y==H//2  else 0)

Submission status: Wrong Answer

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

tate_min = min((W - x) * H, x * H)
yoko_min = min((H - y) * W, y * W)

# 線上
if tate_min == 0 or yoko_min == 0:
  area = W * H / 2
  w = 0
else:
  #0,0からの直線
  naname_00 = (x / (y/H)) * H / 2
  #W,0
  naname_w0 = ((W-x) / (y/H)) * H / 2
#  print(naname_00, naname_w0, naname_0h, naname_wh)
  area_l = [tate_min, yoko_min, naname_00, naname_w0]
  area = max(area_l)
  area_l.sort(reverse=True)
  w = 1 if area_l[0] == area_l[1] else 0

print(area, w)

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int,input().split())
a_top = W*y
a_under = W*(H-y)
a_left = x*H
a_right = (W-x)*H

area = max(min(a_top,a_under),min(a_left,a_right))
is_center = 0 
# 図形の中心を分割点が通る場合
if (W == x*2 and H == y*2):
  is_center =1

if x==0 or y==0:
  area = W*H/2

print("{} {}".format(area,is_center))

Submission status: Wrong Answer

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

if W/2 == x and H/2 == y:
	S = W*H/2
	print("%f %d" % (S,1))
elif W*y == H*x or H*x + W*y == W*H:
	print("%f %d" % (W*H/2,0))
elif x == 0 or y == 0 or x == W or y == H:
	print("%d 0" % (W*H/2))
else:
	S1 = min(x,W-x) * H
	S2 = min(y,H-y) * W
	if S1 == S2:
		print("%f %d" % (max(S1,S2),1))
	else:
		print("%f %d" % (max(S1,S2),0))

Submission status: Wrong Answer

Solution code:
from sys import stdin

W, H, x,y=map(int, stdin.readline().split())
width=x
height=y

if x > W/2:
  width=W-x
if y > H/2:
  height=H-y
  
rect1 = width*H
rect2 = W*height

multiflg=0
maxRect=max(rect1, rect2)
if rect1 == rect2:
  multiflg=1
if maxRect == rect1 and 2*x == W:
  multiflg=1
if maxRect == rect2 and 2*y == H:
  multiflg=1

print("{} {}".format(maxRect, multiflg))

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [W, H, x, y] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    if(W * y == H * x or y * W ==  (-H * x) + W * H):
        print "%20.15f %d" % (float(W)/2.0 * H , ans2)
        return

    ans = max(min(float(H - y), float(y)) * float(W), min(float(W - x), float(x)) * float(H))
    if (H /2 == y) and (W/2 == x) and (H % 2 == 0) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0
    print "%20.15f %d" % (ans, ans2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if H-y>y:
    high=y
else:
    high=H-y

if W-x>x:
    wide=x
else:
    wide=W-x
if wide ==0 and high==0:
    j=0
    print((W*H)/2)
elif W*high==H*wide:
    j=1
    print(W*high," ",j)
elif W*high > H*wide:
    j=0
    print(W*high," ",j)
elif W*high < H*wide:
    j=0
    print(H*wide," ",j)

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
#case1
a=x*H
b=(W-x)*H

if a>=b:
    case1=b
else:
    case1=a

#case2
c=W*y
d=W*(H-y)

if c>=d:
    case2=d
else:
    case2=c

if round(case1,9)==round(case2,9):
    z=1

else:
    z=0

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

Submission status: Wrong Answer

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

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

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

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

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

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

out2 = 0

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Xeq = 0

if H * (W-x) > H * x:
    Xeq = H*x
else:
    Xeq = H * (W-x)

Yeq = 0
if W * (H-y) > W * y:
    Yeq = W*y
else:
    Yeq = W* (H-y)

judge = 0
if Xeq == Yeq:
    judge = 1
    
if Xeq > W*H or Yeq > W*H:
    Xeq =0
    Yeq = 0


if Xeq < Yeq:
    print("{} {}".format(Yeq,judge))
else:
    print("{} {}".format(Xeq, judge))

Submission status: Wrong Answer

Solution code:
a = input().split()
w = int(a[0])
h = int(a[1])
x = int(a[2])
y = int(a[3])

def main():
    if ( w == x and h == y ) or (x==0 and y==0):
        print(w*h/2, 0)
    else:
        mx = w - x    
        my = h - y
        m1 = mx*h
        m2 = my*w
        m3 = x * h
        m4 = y * w
        minv1 = min([m1,m3])
        minv2 = min([m2,m4])
        res = max((minv2, minv1))
        allc = [m1,m2,m3,m4]
        if minv2 != minv1:
            res2 = 0
        else:
            res2 = 1
        print(res, res2)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

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

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

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