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 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 = W*H/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 = W*H/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:
W,H,x,y = map(int,input().split())
if x==0 or x==W or y==0 or y==H:
  s = H*W/2
else:
  a = min(x*H,(W-x)*H)
  b = min(y*W,(H-y)*W)
  s = max(a,b)
print('{:.10f}'.format(s))
if y == H*x/W:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
r=h/w
l=-1 * h/w
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 == r or y/x == l or (h - y)/x == r or (h - y)/x == l:
    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())


ym = min(y, h - y)
xm = min(x, w - x)

s1 = ym * w
s2 = xm * h
s = max(s1, s2)

o = 0
if s1 == s2:
    o = 1
print("{:.6f} {}".format(s, o))

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
    
elif x == W/2 or y ==H/2:
    ans = H*W/2
    if x == W/2 and y == H/2:
        ans2 = 1
    else:
        ans2 = 0
        
else:
    v1 = min(x,W-x)*H
    v2 = min(y,H-y)*W
    
    ans = max (v1,v2)
    if v1 == v2:
        ans2 = 1
    else:
        ans2 = 0

        
print(ans,ans2)

Submission status: Wrong Answer

Solution code:
#2 3 1 2     3 0
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 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:
a = list(map(int,input().split()))
W = a[0]
H = a[1]
x = a[2]
y = a[3]
#W,H,x,y = list(map(int,input().split(" ").rstrip("")))
#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:
# coding: utf-8# coding: utf-8
W, H, x, y = map(int, input().split())
w = W - x
h = H - y
one = [h*W, y*W]
two = [w*H, x*H]
ans = max(min(one), min(two))
if W == H:
    print(ans, 1)
else:
    print(ans, 0)

Submission status: Wrong Answer

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

if x == W or y == H or x == 0.0 or y == 0.0:
    ans = H*W/2
    ans_2 = 0
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:
c=list(map(int, input().split()))

W = c[0]
H = c[1]
x = c[2]
y = c[3]

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

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

if S1 < S2:
    Sm = S2
    co = 0
elif S1 > S2:
    Sm = S1
    co = 0
else:
    Sm = S1
    co = 1
    
print(Sm,co)

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)
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)
    menseki = min(XX, YY)
    print(menseki)
    print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def main():
    if (x, y) in [(0, 0), (0, H), (W, 0), (W, H)]:
        print(W * H / 2, "0")
    elif y == 0 or y == H:
        r1 = x * H / 2
        r2 = (W - x) / 2
        print(max(r1, r2), "1" if r1 == r2 else "0")
    elif x == 0 or x == W:
        r1 = y * W / 2
        r2 = (H - y) / 2
        print(max(r1, r2), "1" if r1 == r2 else "0")
    else:
        r1 = min(x * H, (W-x) * H)
        r2 = min(y * W, (H-y) * W)
        print(max(r1, r2), "1" if r1 == r2 else "0")
main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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 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:
WHxy = list(map(int, input().split()))
W = WHxy[0]
H = WHxy[1]
x = WHxy[2]
y = WHxy[3]

Xeq = H * (W-x)
XeqL = H * x

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


Yeq = W * (H-y)
YeqL = W * (y)

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



judge = 0
if Xeq == Yeq:
    judge = 1


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

Submission status: Wrong Answer

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


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

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

    print(ans1,ans2)
    return


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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
W,H,x,y = map(int,input().split())
min_s = H*(W-2*x)
ts = H*x
flag = 0 
for d in range(360):
    if(d == 90 or d == 270):
        continue
    rad = np.deg2rad(d)
    a = np.tan(rad)
    h = a*W - 2*a*x + 2*y
    men = (a*x-y+h/2)*W
    s = round(abs(W*H - 2 * men),9)
    if min_s > s:
        min_s = s
        ts = men
    elif min_s == s:
        flag = 1
    
print(ts,flag)

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/2 == x and h/2 == y) \
or (w == x and 0 == y) \
or (0 == x and h == y) \
or (w == x and h == y) \
or (0 == x and 0 == y):
  print(s,0)
else:
  print(s,1)

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+0.5*(N[0]*N[1]%2)," ",num)

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:
    print(4)
    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), 1)

Submission status: Wrong Answer

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

if w / 2 == x and h / 2 == y:
    print((w - x) * h,end=" ")
    print(1)
elif x == 0 and y == 0:
    print(w * h / 2,end=" ")
    print(0)
elif x == 0:
    print(((h - y) * w) / 2,end=" ")
    print(0)
elif y == 0:
    print(((w - x) * h) / 2,end=" ")
    print(0)
elif w / x == h / y:
    print(w * h / 2,end=" ")
    print(0)
elif w / 2 == x:
    print(x * h,end=" ")
    print(0)
elif h / 2 == y:
    print(w * y,end=" ")
    print(0)
else:
    print(max(w * y,x * h),end=" ")
    print(0)

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
    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:
W,H,x,y = map(float,input().split())
width = max(x, W-x)
height = max(y, H-y)
menseki_1 = width*H
menseki_2 = height*W
menseki = min(menseki_2,menseki_1)
if menseki_1==menseki_2:
    print("{:.9f}".format(menseki), '1')
elif menseki_1<menseki_2 and height==H/2:
    print("{:.9f}".format(menseki), '1')
elif menseki_2<menseki_1 and width==W/2:
    print("{:.9f}".format(menseki), '1')
elif menseki == ((H*W)/2):
    print("{:.9f}".format(menseki), '1')
else:
    print("{:.9f}".format(menseki), '0')

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')
else:
    print(str(b) + ' 0')

Submission status: Wrong Answer

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

point=0

if x<y:
    W=W-x

elif y<x:
    H=H-y

else:
    W=x
    H-y
    point+=1
    
area=(W*H)

print(area,point)

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 min(x*H,H*(W-x)) > min(y*W,W*(H-y)):
    hoge += 1


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

print(ans,i)

Submission status: Wrong Answer

Solution code:
W , H , x , y = (int(i) for i in input().split())
S1 = 0
S2 = 0
if x <= W/2 and y <= H/2:
  S1 = x*H
  S2 = W*y
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')
elif x > W/2 and y <= H/2:
  S1 = (W-x)*H
  S2 = W*y
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')
elif x < W/2 and y > H/2:
  S1 = x*H
  S2 = W*(H-y)
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')
else:
  S1 = (W-x)*H
  S2 = W*(H-y)
  if S1 > S2:
    print(S1,'0')
  elif S1 < S2:
    print(S2,'0')
  else:
    print(S1,'1')

Submission status: Wrong Answer

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

candidate1 = [x*H, (W-x)*H]
candidate2 = [W*y, W*(H-y)]

candidate1 = [i for i in candidate1 if i != 0]
candidate2 = [i for i in candidate2 if i != 0]
min1 = min(candidate1)
min2 = min(candidate2)
max12 = max(min1, min2)

if min1 != min2:
    way = 0
else: way = 1

print(max12, way)

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
        if 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:
W, H, x, y = map(int, input().split())
jufuku = 0
if y == H * x / W or y == -H * x / W + H:
    naname = W * H / 2
    jufuku = 1
    kiri = naname
else:
    # 縦
    tate = min((W - x) * H, x * H)
    # 横
    yoko = min(W * (H - y), W * y)
    if tate == yoko:
        jufuku = 1
    kiri = max(tate, yoko)
print(kiri, jufuku)

Submission status: Wrong Answer

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

#min(a,b)
ans1 = min(h*x,h*(w-x))
ans2 = min(w*y,w*(h-y))
if ans1 == ans2:
    print(ans1,1)
else:
    print(max(ans1,ans2),0)

Submission status: Wrong Answer

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

area = float(W * H * 0.5)
mul = 0
if x == W // 2 and y == H // 2:
    mul = 1
print(area, mul)

Submission status: Wrong Answer

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


ym = min(y, h - y)
xm = min(x, w - x)

s = max(ym * w, xm * h)

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

Submission status: Wrong Answer

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


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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if (w-x)*h == w*(h-y):
    print((w-x)*h, 1)
else:
    if min((w-x)*h,x*h) == min(w*(h-y),w*y):
        print(min((w-x)*h,x*h),1)
    elif min((w-x)*h,x*h) > min(w*(h-y),w*y):
        print(min((w-x)*h,x*h),0)
    elif min((w-x)*h,x*h) < min(w*(h-y),w*y):
        print(min(w*(h-y),w*y), 0)

Submission status: Wrong Answer

Solution code:
W, H, X, Y = map(int, input().split())

rectangle = W * H
harf = rectangle / 2

x = H * X
y = W * Y

if harf == x and harf != y:
    print(harf, 0)
elif harf != x and harf == y:
    print(harf, 0)
else:
    print(harf, 1)

Submission status: Wrong Answer

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

if y-H/W*x<1e-8 or y-(-H/W*x+H)<1e-8:
    area = W*H/2
    if W/2-x<1e-8 and H/2-y<1e-8:
        num=1
    else:
        num=0
# elif (x, y)==(W, 0) or (x, y)==(W, H) or (x, y)==(0, H):
#     area = W*H/2
#     num = 0
else:
    x_u = W-x
    x_d = x

    x_pat = [x_u*H, x_d*H]

    y_u = H-y
    y_d = H-y

    y_pat = [y_u*W, y_u*W]

    if min(x_pat)>min(y_pat):
        area = float(min(x_pat))
    else:
        area = float(min(y_pat))

    if min(x_pat)==min(y_pat):
        num = 1
    else:
        num = 0
    
print(area, num)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
if x==0 or y==0 or x==w or y==h:
    print('{:6f}'.format(w*h/2),0)
elif (w-x)*h==w*(h-y):
    if (w-x)*h==x*h:
        print('{:6f}'.format(w*h/2),1)
    else:
        print('{:6f}'.format(w*h/2),0)
elif min((w-x)*h,x*h)>min(w*(h-y),w*y):
    print('{:6f}'.format(min((w-x)*h,x*h)),0)
else:
    print('{:6f}'.format(min(w*(h-y),w*y)),0)

Submission status: Wrong Answer

Solution code:
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 == l:
        flag = 1
else:
    s = l
    if s == k:
        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())

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

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = [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, 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())


if w == 2*x:
    ans1 = x*h
elif h == 2*y:
    ans1 = y*w
else:
    a = -(h-2*y)/(2*x-w)
    b = -a*x+y
    ans1 = min(w*(a*w+2*b)/2, (2*h-a*w-2*b)*w/2)

if w == h:
    ans2 = 1
else:
    ans2 = 0

print(ans1,' ',ans2)

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=float(H/W)
else:
    if x == 0 and y != H:
        a=0
    elif x == 0 and y == H:
        a=float(H/W)
    else:
        a=float(y/x)
    if y == 0 and x ==W:
        a=float(H/W)
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 = map(int,input().split())
area = w*h/2

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(i) for i in input().split()]
print(W*H/2, 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
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 = [int(x) for x in input().split()]

num = 0
heaf = W*H/2

if W == H:num = 1
print("{} {}".format(heaf, num))

Submission status: Wrong Answer

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

#sqA
sqA = min(H * x, H * (W - x))
#sqB
sqB = min(y * W, (H - y) * W)


if '{0:.6f}'.format(sqA) != '{0:.6f}'.format(sqB):
   print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "0")
    #print(str(max(sqA,sqB))+ ' ' + "1")
else:
   print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "1")
    #print(str(max(sqA,sqB))+ ' ' + "0")

Submission status: Wrong Answer

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

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

    print(area, 0)

Submission status: Wrong Answer

Solution code:
import numpy as np
W,H,x,y = map(int,input().split())
min_s = H*(W-2*x)
ts = H*x
flag = 0 
for d in range(360):
    if(d == 90 or d == 270):
        continue
    rad = np.deg2rad(d)
    a = np.tan(rad)
    h = a*W - 2*a*x + 2*y
    men = (a*x-y+h/2)*W
    s = round(abs(W*H - 2 * men),9)
    if min_s > s:
        print("oi")
        min_s = s
        ts = men
    elif min_s == s:
        flag = 1
    
print(ts,flag)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int,input().split())
a=w*h
b=x*h
c=y*w
g=0
d=(h-y)*w//2
e=a-d
f=min((a-c),c)
i=min((a-b),b)
if b==c or d==f or d==e or i==f or i==e:
    g=1
if x!=w and y!=h:
    print("{:.9f}".format(max(min(a-max(b,c),max(b,c)),min(a-min(b,c),min(b,c)))),g)
elif x==w:
    print("{:.9f}".format(f),g)
elif y==h:
    print("{:.9f}".format(i),g)

Submission status: Wrong Answer

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

if x == 0 or x == W: a = W * H
else: a = min(x * H, (W - x) * H)
if y == 0 or y == H: 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:
w,h,x,y = map(int, input().split())
max = float((w * h) / 2)
if w * y == x * h:
  print(str(max) + ' 1')
else:
  print(str(max) + ' 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

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

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):
    menseki=min((w*y),w*h-w*y)
    judge=0
elif (h/w)>(y/x):
    menseki=min((h*x),w*h-h*x)
    judge=0

print(menseki,judge)

Submission status: Wrong Answer

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

#角にのってる場合
if x == 0 and y ==0:
    print(W*H/2, 1, sep=' ')

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

Submission status: Wrong Answer

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

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

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

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

# 対角線
if (x != 0 and y != 0):
    if (W / x == H / y):
        ans = W * H / 2.0
        if (x == W - x and y == H -y):
            multi_ans = 1
        else:
            multi_ans = 0

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

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

Submission status: Wrong Answer

Solution code:
t = list(map(int, input().split()))
S = t[0] * t[1] / 2
print(S,'1')

Submission status: Wrong Answer

Solution code:
#2 3 1 2     3 0
w,h,x,y = map(float,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(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(float(s),r)

Submission status: Wrong Answer

Solution code:
WW, HH, XX, YY = input().split()
W = int(WW)
H = int(HH)
X = float(XX)
Y = float(YY)
SV1 = X * H
SV2 = (W - X) * H
SH1 = W * Y
SH2 = W * (H - Y)
SV = min([SV1, SV2])
SH = min([SH1, SH2])
S = max(SV, SH)
print(S, 1 if SH == SV else 0)

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