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

if w / 2 == x and h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif y == (h / w) * x or y == (-h * w) * x + h:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 1)

elif w / 2 == x or h / 2 == y:
    ans = w / 2 * h
    print("{:.6f}".format(ans), 0)

# elseでミスってる
else:
    b = y - x
    check1 = w + b
    check2 = -b
    ans1 = (check1 * (w - check2)) / 2

    b = y + x
    ans2 = b * b / 2
    ans = max(ans1, ans2)
    print("{:.6f}".format(ans), 0)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = list(map(int, input().split()))
num=0
if N[2]*2==N[0] & N[3]*2==N[1]:
    num=1
print(N[0]*N[1]/2," ",1)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(item) for item in input().split()]
S = W * H
if x == 0 or y == 0 or x == W or y == H:
  if (x == 0 and y == 0):
    print (S/2, 0)
  else:
    print (S/2, 1)
else:
  m = max(min(x/W, 1-x/W), min(y/H, 1-y/H))
  ans_s = S * m
  ans_m = 0
  if (x/W == 0.5 and y/H==0.5):
    ans_m = 1
  print (ans_s, ans_m)

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(int,input().split(" ")))
#print(W,H,x,y)
#横にラインを引く
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 float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
    elif float(x) == float(W)/2.0:
        tatemax = float(H) * float(x)
if yokomax == tatemax: 
    print(max(yokomax,tatemax),'1')   
#    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print(max(yokomax,tatemax),'0')
#    print('{:.12e}'.format(max(yokomax,tatemax)),'0')

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#2 3 1 2     3 0
w,h,x,y = map(int,input().split())

if w == h:
    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))
else:
    f = max(w,h)
    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
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))

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

elif x == 0 or x == w:
    output = (y+(h-y)) * w/2
elif y == 0 or y == h:
    output = (x+(w-x)) * 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())

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

if H == W:
    if x == y:
        k = (W*H)/2
    elif y + x == H:
        k = (W*H)/2


if H == 1 and W == 1:
    k = 0.5
    ans = 0


print(k,ans,sep=" ")

Submission status: Wrong Answer

Solution code:
#coding:utf-8
w,h,x,y = map(int,input().split())
flag = 0
if w == 2*x and w == 2*y:
    flag = 1
print (str(h*w/2)+" "+str(flag))

Submission status: Wrong Answer

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

if x == 0: a = W * H
else: a = min(x * H, (W - x) * H)
if y == 0: b = W * H
else: b = min(y * W, (H - y) * W)
 
if a == b: print('{:.6f} 1'.format(a))
elif a < b: print('{:.6f} 0'.format(b))
else: print('{:.6f} 0'.format(a))

Submission status: Wrong Answer

Solution code:
import sys
a=list(map(int,input().split()))
W=a[0]
H=a[1]
x=a[2]
y=a[3]
print(W*H/2)
f1,f2=0,0
if x==W/2:
    f1=1
if y==H/2:
    f2=1
if x==W or y==H:
    print('0')
    sys.exit()
if f1==1 or f2==1:
    if f1==f2:
        print('1')
        sys.exit()
    else:
        print('0')
        sys.exit()
if W*y==H*x or W*y==H*(-x+1):
    print('1')
else:
    print('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 != 0:
  if x == (int(W/2)):
    pl = 1
  else:
    pl = 0
  
if y != 0:
  if y == (int(H/2)):
    pl = 1
  else:
    pl = 0
  
print(str(S_max) + " " + str(pl))

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
men=W*H/2
if x == 0 and y == 0:
    a=1
else:
    if x == 0 and y != H:
        a=0
    elif x == 0 and y == H:
        a=1
    else:
        a=float(y/x)
    if y == 0 and x ==W:
        a=1
b=float(H/W)
W2=float(W/2)
H2=float(H/2)
cross=0
if a == b or x == W2 or y == H2:
    if a == b and x == W2:
        cross=1
    elif a == b and y == H2:
        cross=1
    elif x == W2 and y == H2:
        cross=1
    print("{0:.6f}".format(men),cross)
elif a > b:
    anx=float(H/a)
    men=(anx*H)/2
    print("{0:.6f}".format(men),cross)
else:
    any=float(W*a)
    men=(W*any)/2
    print("{0:.6f}".format(men),cross)

Submission status: Wrong Answer

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

area_h = min(abs(w*(h-y)), abs(w*y))
area_v = min(abs(h*(w-x)), abs(h*x))

val = 1 if area_h == area_v else 1

print(max(area_h, area_v), val)

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:
    if W*y == H*x or W*y == -H*x+H*W:
        area = H*W/2
        print(area, 1)
    
    area = min(W*y, W*(H-y))
    if area < min(H*x, H*(W-x)):
        area = min(H*x, H*(W-x))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(max([tate, yoko]))
if abs(tate - yoko) <= 0.1**9:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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


if (x==0 and y==0) or (x==w and y==0) or (x==0 and y==h)or (x==w and y==h):
    print(h*w*0.5,0)

elif x==0 or y==0 or x==w or y==h:
    print(h*w*0.5,0)
elif h/w == y/x or -h/w == (y-h)/x:
    if x*2 ==w:
        print(w*h*0.5,1)
    else:
        print(w*h*0.5,0)
else:
    if (0.5*w>=x)and(0.5*h>=y):
        s1 = x*h
        s2 = y*w
    elif (0.5*w>=x)and(y>=0.5*h):
        s1 = x*h
        s2 = (h-y)*w
    elif (x>0.5*w)and(0.5*h>=y):
        s1 = (w-x)*h
        s2 = y*w
    else:
        s1 = (w-x)*h
        s2 = (h-y)*w
    
    print(max(s1,s2),0)

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 = (int(i) for i in input().split())
a1 = w*h/2
a2 = 0
if (w==h and not (x==w/2 or y == h/2) and not ((x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h)) or (x==w/2 and y==h/2)):
    a2 = 1

print(a1, a2)

Submission status: Wrong Answer

Solution code:
W, H, x, y = list(map(int, input().split()))
res = 0
if (x == 0 and y == H) or (x == W and y == 0) or (x == W and y == H) or (x == 0 and y == 0):
  res = float(W * H / 2)
elif (W - x) >= (H - y):
  res = float((W - x) * H)
else:
  res = float((H - y) * W)

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

print("{:f} {}".format(res, str(div_flg)))

Submission status: Wrong Answer

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

o1 = (w * h) / 2

if (x, y) is (w/2, h/2):
  o2 = 1
else:
  o2 = 0
  
print(o1, o2)

Submission status: Wrong Answer

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

v1 = min(x,W-x)*H
v2 = min(y,H-y)*W

ans = max (v1,v2)

if v1 > v2:
    if y == H/2:
        ans2 = 1
    else:
        ans2 = 0
else:
    if x == W/2:
        ans2 = 1
    else:
        ans2 = 0
        
print(ans,ans2)

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))
elif (W == H and x == y) and (x != W / 2 and y != W / 2):
    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())

S1 = H*x
S2 = H*(W-x)
S3 = W*y
S4 = W*(H-y)

if x == y or y == -H/W*x+H:
    ans_S = H*W/2
else:
    ans_S = max(min(S1,S2), min(S3, S4))

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

print('{:.6f}'.format(ans_S), ans)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
if W > H:
    W, H, x, y = H, W, H - y, x
Gx, Gy = W/2, H/2
if Gx < x:
    x = W - x
if Gy < y:
    y = H - y
C = y + (H/W) * x
C2 = y - (H/W) * x
s1, s2, s3, s4 = x*H, y*W, 0.5*C*C*(W/H), 0.5*(W+(W/H)*C2)*(H+C2)
res = [s1, s3, s3, s4]
res.sort()
if x == 0 or x == W and y == 0 or y == H:
    print(0, 1)
else:
    print(max(s1, s2, s3, s4), 1 if res[-1] == res[-2] else 0)

Submission status: Wrong Answer

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

S = W * H

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

k = max(a, b)
l = max(c, d)
p = min(a, b)
q = min(c, d)
flag = 0

if q <= p:
    s = k
    if s == c or s == d:
        flag = 1
else:
    s = l
    if s == a or s == b:
        flag = 1
'''
if [x, y] == [0, 0] or [x, y] == [0, H] or [x, y] == [W, 0] or [x, y] == [W, H]:
    flag = 0
if x == 0 or x == W or y == 0 or y == H:
    flag = 0
'''
print(s, flag)

Submission status: Wrong Answer

Solution code:
W,H,x,y=map(int,input().split())
cnt = 0
flag = 0
area_1_x = x * H
area_2_x = (W-x) * H
area_1_y = y * W
area_2_y = (H-y) * W
if H == y and W == x:
    print('{:.6f}'.format(0),"0")
    exit()
if area_1_x > area_2_x:
    area_x = area_2_x
else:
    area_x = area_1_x
if area_1_y > area_2_y:
    area_y = area_2_y
else:
    area_y = area_1_y

if H == y:
    area_y = 0
elif W == x:
    area_x == 0



if area_x > area_y:
    print(area_y)
    m = float(area_x)
    print('{:.6f}'.format(m),"0")
elif area_x == area_y:
    m = float(area_x)
    print('{:.6f}'.format(m),"1")
else:
    m = float(area_y)
    print('{:.6f}'.format(m),"0")

Submission status: Wrong Answer

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

wx = W - x
a = wx * H

hy = H - y
b = hy * W

count = 1 if a==b else 0
print(max(a, b), count)

Submission status: Wrong Answer

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

s = (w*h/2)

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

Submission status: Wrong Answer

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

area_h = min(abs(x*(h-y)), abs(x*y))
area_v = min(abs(y*(w-x)), abs(x*y))

val = 1 if area_h == area_v else 1

print(max(area_h, area_v), val)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from collections import Counter
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def main():
    W, H, x, y = map(int, input().split())
    split_1 = sorted([x * H, (W - x) * H])
    split_2 = sorted([y * W, (H - y) * W])
    print(float(max(split_1[0], split_2[0])), 0)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

d_center_W = abs(W/2 - x)
d_center_H = abs(H/2 - y)
d_45_plus =  abs((H/W)*x-1*y)/np.sqrt((H/W)**2+(-1)**2)
d_45_minus = abs((H/W)*x+y-H)/np.sqrt((H/W)**2+1**2)

min_d = min(d_center_W,d_center_H,d_45_plus,d_45_minus)
smflg = False

if [d_center_W,d_center_H,d_45_plus,d_45_minus].count(min_d) > 1:
        smflg = True

ans = 0

if min_d == d_center_W:
        if x <= W/2:
                ans = x*H/1
        else:
                ans = (W-x)*H/1
elif min_d == d_center_H:
        if y <= H/2:
                ans = y*W/1
        else:
                ans = (H-y)*W/1
elif min_d == d_45_plus:
        if x == 0:
                ans = H-(y-(H/W)*x)*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = H-(y-(H/W)*x)*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
elif min_d == d_45_plus:
        if x <= W/2:
                x += (W/2-x)*2
        else:
                x -= (x-W/2)*2
        if x == 0:
                ans = H-(y-(H/W)*x)*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = H-(y-(H/W)*x)*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
if smflg:
        smstr = '1'
else:
        smstr = '0'

if H == 1 and W == 1:
        ans = 1/2

print(str(ans) + ' ' + smstr)

Submission status: Wrong Answer

Solution code:
from sys import stdin

def main():
    W, H, X, Y = map(int, input().split())

    area = []
    a = min(X, W - X) * H
    if a:
        area.append(a)

    a = W * min(Y, H - Y)
    if a:
        area.append(a)

    w1 = W - X
    w2 = w1 - H if w1 > H else 0
    h = min(w1, H)
    a = (w1 + w2) * h / 2
    if a:
        area.append(a)

    w1 = X
    w2 = w1 - H if w1 > H else 0
    h = min(w1, H)
    a = (w1 + w2) * h / 2
    if a:
        area.append(a)

    ans1 = max(area)
    if area.count(ans1) > 1:
        ans2 = 1
    else:
        ans2 = 0
    print(ans1, ans2)

input = lambda: stdin.readline()
main()

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
s=0
way=0
frag=True

if w/2 == x and h/2 == y:
  way=1
  s=w*h/2
  frag=False

elif (x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h):
  way=0
  s=w*h/2
  frag=False

elif x != 0 and y != 0:
  if y/x == h/w:
    way=0
    s=w*h/2
    frag=False

if frag==True:
  oy,yh,ox,xw=y,h-y,x,w-x
  yoko=min(oy*w,yh*w)
  tate=min(ox*h,xw*h)
  way=0
  s=max(yoko,tate)

print(float(s),way)

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
    if(W%2 != 0):
        if(x+1 == W-x):
            ans2=1
elif(X*H == Y*W):
    ans1 = X*H
    ans2 = 1
else:
    ans1 = Y*W
    if(H%2 != 0):
        if(y+1 == H-y):
            ans2=1

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from collections import Counter
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def main():
    W, H, x, y = map(int, input().split())
    split_1 = sorted([x * H, (W - x) * H])
    split_2 = sorted([y * W, (H - y) * W])
    print(float(max(split_1[0], split_2[0])), 1)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(int,input().split(" ")))
#print(W,H,x,y)
#横にラインを引く
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 float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
    elif float(x) == float(W)/2:
        tatemax = float(H) * float(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(float, input().split())
a1, a2 = (w - x) * h, x * h
A = min(a1, a2)
B = min((h - y) * w, y * w)
res = "0"
if A == 0 or A == B:
        res = "1"
print("{0:.06f}".format(max(A, B)), res)

Submission status: Wrong Answer

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


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

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

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


w, h, x, y = MI()
halfw = 2/w
halfh = 2/h
ans = []

ans.append((w * h) / 2)
if x == halfw and y == halfh:
    ans.append(1)
else:
    ans.append(0)
print(*ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

    if tate == yoko:
        ans_2 = 1
    else:
        ans_2 = 0

print(ans, ans_2)

Submission status: Wrong Answer

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

kaburi = 0
xMin = min(y * W, (H - y) * W)
yMin = min(x * H, (W - x) * H)

if x == 0 or y == 0 or x == W or y == H:
    ans = W * H / 2
elif xMin == yMin or x == W/2 or y == H/2:
    kaburi = 1
    ans = W * H / 2
else:
    ans = max(xMin, yMin)

print('{0} {1}'.format(ans, kaburi))

Submission status: Wrong Answer

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

S = W * H

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

k = max(a, b)
l = max(c, d)
p = min(a, b)
q = min(c, d)
flag = 0

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

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

print(s, flag)

Submission status: Wrong Answer

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

s = w * h
s1 = x * h
s2 = y * w
ans = 0

if s - s1 >= s1 and s1 > ans:
	ans = s1
if s - s1 <= s1 and (s - s1) > ans:
	ans = s - s1
if s - s2 >= s2 and s2 > ans:
	ans = s2
if s - s2 <= s2 and (s - s2) > ans:
	ans = s - s2

cnt = 0
if s - s1 >= s1 and s1 == ans:
	cnt += 1
elif s - s1 <= s1 and (s - s1) == ans:
	cnt += 1
if s - s2 >= s2 and s2 == ans:
	cnt += 1
elif s - s2 <= s2 and (s - s2) == 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 = [int(i) for i in input().split()]
if W > H:
    W, H, x, y = H, W, H - y, x
Gx, Gy = W/2, H/2
if Gx < x:
    x = W - x
if Gy < y:
    y = H - y
C = y + (H/W) * x
C2 = y - (H/W) * x
s1, s2, s3, s4 = x*H, y*W, 0.5*C*C*(W/H), 0.5*(W+(W/H)*C2)*(H+C2)
if x == 0 or x == W and y == 0 or y == H:
    print(0, 1)
else:
    print(max(s1, s2, s3, s4), 1 if s1 == s2 or s2 == s3 or s3 == s1 or s4 == s2 or s4 == s1 or s4 == s3  else 0)

Submission status: Wrong Answer

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

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

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

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

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int,input().split())
ans = 0
flag = "1"
if  ((W%2!=0 and W!=0) or (H%2!=0 and H!=0)):
    flag = "0"

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

print(format(ans,'.9f'), flag)

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(item) for item in input().split()]
S = W * H
if x == 0 or y == 0 or x == W or y == H:
  if (x==0 and y == 0):
    print (S/2, 0)
  else:
    m = max(min(x/W, 1-x/W), min(y/H, 1-y/H))
    ans_s = S * m
    print (ans_s, 0)
else:
  m = max(min(x/W, 1-x/W), min(y/H, 1-y/H))
  ans_s = S * m
  ans_m = 0
  if (x/W == 0.5 and y/H==0.5):
    ans_m = 1
  print (ans_s, ans_m)

Submission status: Wrong Answer

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

#四角形の中点の座標
my_x = (0+W)/2
my_y = (0+H)/2
#中点を通る直線の傾き
my_k = my_y/my_x

my_cnt = 0 

#print(my_x,my_y)
#右下がり上を通るか？
if x * my_k == y:
  my_cnt += 1
#右下がり上を通るか？
if x * -1 * my_k + H == y:
  my_cnt += 1

if my_cnt == 1:
  print(W*H/2, 0)
elif my_cnt >= 2:
  print(W*H/2, 1)
  
else:
  mys1 = min(W*(H-y),(W*H)-(W*(H-y))) #yで分割
  mys2 = min(H*(W-x),(W*H)-(W*(W-x))) #yで分割
  
  print(max(mys1,mys2), 0)

Submission status: Wrong Answer

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