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:
def main():

    w,h,x,y=list(map(int,input().split()))


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

    elif(y==(h/w)*x or y==-(h/w)*x):
        s=w*h/2
        print(s,0)
   
    else:
        s_11=w*(h-y)
        s_12=w*y
        S1=min([s_11,s_12])

        s_21=h*x
        s_22=h*(w-x)
        S2=min([s_21,s_22])

        #if S1==S2:
        #    S=w*h/2
        #    print(S,0)
        #else:
        S=max([S1,S2])
        print(S,0)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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


main()

Submission status: Wrong Answer

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

men = W*H
hidari =(x-0)*H
migi = men-hidari
ue = W*(H-y)
sita = men-ue

ans1 = min([hidari,migi])
ans2 = min([ue,sita])


if ans1 == ans2:
  print(ans1, 1)
elif ans1 >= ans2:
    print(ans1,0)
elif ans1 <= ans2:
    print(ans2,0)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  w,h,x,y=LI()

  a1=x*h
  b1=(w-x)*h

  a2=y*w
  b2=(h-y)*w

  m1=m2=inf
  if a1<=b1:
    m1=a1
  else:
    m1=b1

  if a2<=b2:
    m2=a2
  else:
    m2=b2

  if m1==m2:
    if m1==0:
      print(w*h,1)
    else:
      print(m1,1)
  else:
    if m1<=m2:
      print(m2,0)
    else:
      print(m1,0)

main()

Submission status: Wrong Answer

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    W, H, x, y = map(int, input().split())
    
    h = y * W, (H - y) * W
    v = H * x, (W - x) * H

    if min(h) < min(v):
        print("{:.6f} {}".format(min(v), "1" if min(v) in h else "0"))
    else:
        print("{:.6f} {}".format(min(h), "1" if min(h) in h else "0"))

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:
    print(w*h*(1/2),0)
elif a == b:
    print(max(a,b),1)
else:
    print(max(a,b),0)

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(float,input().split()))
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if y >= H/2:
        yokomax = W * (H-y)
    else:
        yokomax = W * (y)
    if x >= W/2:
        tatemax = H * (W-x)
    else:
        tatemax = H * x
if yokomax == tatemax: 
    print('{:9e}'.format(max(yokomax,tatemax)),'1')
else:
    print('{:9e}'.format(max(yokomax,tatemax)),'0')

Submission status: Wrong Answer

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

if w==h and x==y:
    s=1
elif w==h and (x==w/2 or y==h/2):
    s=1

elif x==w/2 and y==h/2:
    s=1
else:
    s=0


S=w*h/2

print(str(S)+' '+str(s))

Submission status: Wrong Answer

Solution code:
li = list(map(int, input().split()))
W = li[0]  # よこ
H = li[1]  # たかさ
x = li[2]
y = li[3]

menseki = W * H

# 縦に分割
split_x_menseki = x * H
x_ookikunai = min(menseki - split_x_menseki, split_x_menseki)

# 横に分割
split_y_menseki = W * y
y_ookikunai = min(menseki - split_y_menseki, split_y_menseki)

split_flag = 0

if x_ookikunai == y_ookikunai and x+y != 0:
    split_flag = 1

print(max(y_ookikunai, x_ookikunai), split_flag)

Submission status: Wrong Answer

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

a = H * min((W-x),x)
b = W * min((H-y),y)

if a == b:
  print(a, 1)
elif a > b:
  print(a, 0)
else:
  print(b, 0)

Submission status: Wrong Answer

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

if x == W or y == H or x == 0 or y == 0:
	print(W*H/2,end=" ")
	print(0)

elif x == W/2 and y == H/2:
	print(W*H/2,end=" ")
	print(1)
elif x == W/2:
	print(W*H/2,end=" ")
	print(0)
	
elif y == H/2:
	print(W*H/2,end=" ")
	print(0)

else:
	print(W*H/2,end=" ")
	print(1)

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

Submission status: Wrong Answer

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    W, H, x, y = map(int, input().split())
    
    h = y * W, (H - y) * W
    v = H * x, (W - x) * H

    if min(h) < min(v):
        print("{:.6f} {}".format(min(v), "1" if min(v) in h else "0"))
    else:
        print("{:.6f} {}".format(min(h), "1" if min(v) in h else "0"))

Submission status: Wrong Answer

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


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

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

    print(ans1,ans2)
    return


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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  w,h,x,y=LI()

  a1=x*h
  b1=(w-x)*h

  a2=y*w
  b2=(h-y)*w

  m1=m2=inf
  if a1<=b1:
    m1=a1
  else:
    m1=b1

  if a2<=b2:
    m2=a2
  else:
    m2=b2

  if m1==m2:
    if m1==0:
      print(m1,0)
    else:
      print(m1,1)
  else:
    if m1<=m2:
      print(m2,0)
    else:
      print(m1,0)

main()

Submission status: Wrong Answer

Solution code:
import sys
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=1
elif x==0 and y==0:
    ans1=w*h/2
    ans2=1 
elif x==w and y==0:
    ans1=w*h/2
    ans2=1
elif x==0 and y==h:
    ans1=w*h/2
    ans2=1
    
elif 0 < x < w and y==0:
    ans1=w*h/2
    ans2=1
elif 0 < x < w and y==w:
    ans1=w*h/2
    ans2=1  
elif x==0 and 0<y<h:
    ans1=w*h/2
    ans2=1  
elif x==w and 0<y<h:
    ans1=w*h/2
    ans2=1  

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 (W == x or H == y or x == 0 or y == 0):
    res1 = W * H / 2
    res2 = 0
else:
    tate1 = (W - x) * H
    tate2 = x * H 
    tate = min(tate1, tate2)

    yoko1 = W * (H - y)
    yoko2 = W * y
    yoko = min(yoko1, yoko2)

    res1 = max(yoko, tate)
    res2 = int(yoko == tate)

print(res1, res2)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

WHxy = input()
W = int(WHxy.split(' ')[0])
H = int(WHxy.split(' ')[1])
x = int(WHxy.split(' ')[2])
y = int(WHxy.split(' ')[3])

# sukunaihou no menseki
tate_min = 0.0
yoko_min = 0.0

# tate
tate_menseki1 = float((W - x) * H)
tate_menseki2 = float((0 + x) * H)

if tate_menseki1 < tate_menseki2:
    tate_min = tate_menseki1
else:
    tate_min = tate_menseki2

# yoko
yoko_menseki1 = float(W * (H - y))
yoko_menseki2 = float(W * (0 + y))

if yoko_menseki1 < yoko_menseki2:
    yoko_min = yoko_menseki1
else:
    yoko_min = yoko_menseki2

if tate_min < yoko_min:
    print("{0:.9f}".format(yoko_min) + " 0")
elif yoko_min < tate_min:
    print("{0:.9f}".format(tate_min) + " 0")
else:
    print("{0:.9f}".format(tate_min) + " 1")

Submission status: Wrong Answer

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

M=W*H

mW=min(x,W-x)
mH=min(y,H-y)



if H*mW==W*mH:
    print(M*mW/W,1)
elif W==x or H==y or x==0 or y==0:
    print(M/2,0)
elif x*H==(H-y)*W:
    print(M/2,0)
elif x*H==y*W:
    print(M/2,0)
elif (mW/W)>(mH/H):
    print(M*mW/W,0)
else:
    print(M*mH/H,0)

Submission status: Wrong Answer

Solution code:
w,h,x,y=map(int, input().split())
ele=sorted([w,h])[::-1]
if w==x or w==y: #この時には一つしか分割できない
    print(abs(w-x)*h, 0)
elif h==x or h==y:
    print(abs(h-y)*w ,0)
else:
    print(min((w-x)*h, (h-y)*w, w*y, x*h), 1)

Submission status: Wrong Answer

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

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    token = lines[0].split(" ")
    w = int(token[0])
    h = int(token[1])
    x = int(token[2])
    y = int(token[3])

    return (w, h, x, y)


def solve(w, h, x, y):
    
    if (x == 0 or x == w) and (y == 0 or y == h):
        print("%f %d" % (0.5 * w * h, 0))
        return

    left = x
    right = w - x

    above = h - y
    below = y

    if (x == 0 or x == w) and y > 0:
        area2 = min(w * below, w * above)
        print("%f %d" % (area2, 0))
        return

    if x > 0 and (y == 0 or y == h):
        area1 = min(left * h, right * h)
        print("%f %d" % (area1, 0))
        return


    area1 = min(left * h, right * h)
    area2 = min(w * below, w * above)

    area = max(area1, area2)

    duplicate = 0   
    if area1 == area2:
        duplicate = 1

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




def main():
    # 出力

    # print("%s" % solve(*parse_input()))
    solve(*parse_input())


if __name__ == '__main__':

    main()

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,1)
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:
    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())
if W-x < x:
    x = W-x
if H-y < y:
    y = H-y

print(W*H/2,"1")

Submission status: Wrong Answer

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

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

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

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


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

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

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

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

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

print(s * 1.0, flag)

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 y==(H-y):
    print("{:.9f}".format(menseki), '1')
elif menseki_2<menseki_1 and x==(W-x):
    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())
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('{:6f}'.format(w*h/2,0),0)
elif (w-x)*h==w*(h-y):
    print('{:6f}'.format(min((w-x)*h,x*h)),1)
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 = [int(x) for x in input().split()]
if (x == W/2 and y != H/2) or (x != W/2 and y == H/2) or (x == W and y == H) or (x == W and y == 0) or (x == 0 and y == H) or (x == 0 and y == 0):
    print('{:.6f}'.format(W*H/2),0)
elif (x != W/2 and y != H/2 and W != 0 and H != 0 and y == (H/W)*x) or (x != W/2 and y != H/2 and W != 0 and H != 0 and y == H - (H/W)*x):
    print('{:.6f}'.format(W*H/2),0)
else:
    print('{:.6f}'.format(W*H/2),1)

Submission status: Wrong Answer

Solution code:

W, H, x, y = map(int, input().split())
if W-x < x:
    x = W-x
if H-y < y:
    y = H-y

print(W*H/2,"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:
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((W * H) / 2, str(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(area, str(num))

Submission status: Wrong Answer

Solution code:
W, H, x ,y =  map(int,input().split())
half_area = float(W*H)/2.0
if (x == int(float(W*0.5)) ) and (y == int(float(H*0.5)) ):
  num = 1
else:
  num = 0
print('{:.6f}'.format(half_area)+" "+ str(num))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(20000000)

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

# 横分割の時の最小値を求める

A = min(float((H-y)*W), float(y*W))

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

# 最後に最大の方を選ぶ
# このときA=Bなら複数あるということ
if A == B:
    print(max(A, B), 1)
else:
    print(max(A, B), 0)

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


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

Submission status: Wrong Answer

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

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:
#!/usr/bin/env python3
import sys


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

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

    print(ans1,ans2)
    return


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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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)))

# 角たち
a = w * h
if y != 0:
    if h / y * x <= w:
        tmp = h / y * x * h / 2
        area.append(min(tmp, a - tmp))
if h - y != 0:
    if h / (h - y) * x <= w:
        tmp = h / (h - y) * x * h / 2
        area.append(min(tmp, a - tmp))

if x != 0:
    if w / x * y <= h:
        tmp = w / x  * y * w / 2
        area.append(min(tmp, a - tmp))
if w - x != 0:
    if w / (w - x) * y <= h:
        tmp = w / (w - x) * y * w / 2
        area.append(min(tmp, a - tmp))

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:
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


W,H,x,y = IL()

tmp = min(x*H,(W-x)*H)
tmpp = min(y*W,(H-y)*W)

cnt = 0
if tmp == tmpp:
  cnt = 1
print(max(tmp,tmpp),cnt)

Submission status: Wrong Answer

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

ans2 = 0

if(x < W/2):
    X = x

else:
    X = W-x

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

if(X*H > Y*W):
    ans1 = X*H
elif(X*H == Y*W):
    ans1 = X*H
    ans2 = 1
else:
    ans1 = Y*W

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# たて割り
p1 = x * H
p2 = (W - x) * H

# 横割
p3 = W * y
p4 = W * (H - y)

min1 = min(p1, p2)
min2 = min(p3, p4)

zero = [(0, 0), (W, 0), (W, H), (0, H)]

if (x,y) in zero:
    print(0, '0')
    exit()
    
if min1 == min2:
    print(min1, '1')
elif min1 > min2:
    print(min1, '0')
else:
    print(min2, '0')

Submission status: Wrong Answer

Solution code:
def sol(inp=input):
    w,h,x,y=map(int,inp().split())
    s=w*h/2
    m=int(x==w//2 and y==h//2)
    return '{:.1f} {}'.format(s,m)
print(sol())

Submission status: Wrong Answer

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

ans1 = x*h
ans3 = (w-x)*h
ans2 = w*y
ans4 = w*(h-y)
ls1 = [ans1,ans3]
ls2 = [ans2,ans4]

if x == w or y == h or x==0 or y==0:
	print(0,1)
	exit()

if max(ans1,ans3)<max(ans2,ans4):
	m = max(ans1,ans3)
	k = ls2.count(m)
else:
	m = max(ans2,ans4)
	k = ls1.count(m)
print(m,1 if k else 0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

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

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

        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 (x == 0 and y == 0) or (x == 0 and y == H) or (x == W and y == 0) or (x == W and y == H):
    S = W*H/2
    bo = 0
else:
    ta1 = (W-x)*H
    ta2 = x*H
    ta = ta1 if ta1 <= ta2 else ta2
    yo1 = (H-y)*W
    yo2 = y*W
    yo = yo1 if yo1 <= yo2 else yo2
    S = ta if ta >= yo else yo
    bo = 1 if ta == yo else 0
print(S, bo)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

S = W * H
s11 = x * H
s12 = S - s11
s1 = min(s11, s12)

s21 = W * y
s22 = S - s21
s2 = min(s21, s22)

i = 0
if s1 == s2:
  i = 1
  
print(max(s1, s2), i)

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))+ ' ' + "1")
    #print(str(max(sqA,sqB))+ ' ' + "1")
else:
   print('{0:.6f}'.format(max(sqA,sqB))+ ' ' + "0")
    #print(str(max(sqA,sqB))+ ' ' + "0")

Submission status: Wrong Answer

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

if (W == x or H == y):
    res1 = W * H / 2
    res2 = 0
else:
    tate1 = (W - x) * H
    tate2 = x * H 
    tate = min(tate1, tate2)

    yoko1 = W * (H - y)
    yoko2 = W * y
    yoko = min(yoko1, yoko2)

    res1 = max(yoko, tate)
    res2 = int(yoko == tate)

print(res1, res2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
W,H,x,y = list(map(float,input().split()))
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if y >= H/2:
        yokomax = W * (H-y)
    else:
        yokomax = W * (y)
    if x >= W/2:
        tatemax = H * (W-x)
    else:
        tatemax = H * x
if yokomax == tatemax: 
    print('{:e}'.format(max(yokomax,tatemax)),'1')
else:
    print('{:e}'.format(max(yokomax,tatemax)),'0')

Submission status: Wrong Answer

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

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

if ans == 2:
    ans = 1
else:
    ans = 0

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

k = max(tate,yoko)

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



print(k,ans,sep=" ")

Submission status: Wrong Answer

Solution code:
W,H,x,y = map(int, input().split())
if W == x or H == y or x == y == 0:
    S = W * H * 0.5
    print(S,0)
elif 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)
    min1 = min([S1,S2])
    min2 = min([S3,S4])
    if min1 == min2:
        print(min1,1)
    else:
        print(max([min1,min2]),0)

Submission status: Wrong Answer

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

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    token = lines[0].split(" ")
    w = int(token[0])
    h = int(token[1])
    x = int(token[2])
    y = int(token[3])

    return (w, h, x, y)


def solve(w, h, x, y):
    
    if x == 0 and y == 0:
        print("%f %d" % (0.5 * w * h, 0))
        return

    if x == w and y == h:
        print("%f %d" % (0.5 * w * h, 0))
        return

    left = x
    right = w - x

    above = h - y
    below = y

    if (x == 0 or x == w) and y > 0:
        area2 = min(w * below, w * above)
        print("%f %d" % (area2, 0))
        return

    if x > 0 and (y == 0 or y == h):
        area1 = min(left * h, right * h)
        print("%f %d" % (area1, 0))
        return


    area1 = min(left * h, right * h)
    area2 = min(w * below, w * above)

    area = max(area1, area2)

    duplicate = 0   
    if area1 == area2:
        duplicate = 1

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




def main():
    # 出力

    # print("%s" % solve(*parse_input()))
    solve(*parse_input())


if __name__ == '__main__':

    main()

Submission status: Wrong Answer

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

x1 = w - x
y1 = h - y

s = w * h
s1 = x * h
s2 = x1 * h
s3 = y * w
s4 = y1 * w

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

cnt = 0

if s1 == ans:
	cnt += 1
if s2 == ans:
	cnt += 1
if s3 == ans:
	cnt += 1
if s4 == ans:
	cnt += 1

print(ans, end=" ")
if (cnt > 1):
	print(1)
else:
	print(0)

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:
    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())
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')
else:
    print("{:.9f}".format(menseki), '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,end=" ")
	print(1)
elif x == W/2:
	print(W*H/2,end=" ")
	print(0)
	
elif y == H/2:
	print(W*H/2,end=" ")
	print(0)

else:
	print(W*H/2,end=" ")
	print(1)

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
        result = H * x

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


    print(float(result),flag)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

mx = min(x, w-x)*h
my = min(y, h-y)*w
if (x == 0 or y == 0) or (x == w or y == h):
    print(max(mx, my), 0)
else:
    s = w*h/2
    if h/w == y/x or w/h == x/y:
        if mx == my or my == s or s == mx:
            print(s, 1)
        else:
            print(s, 0)
    elif mx == my:
        print(mx, 1)
    else:
        print(max(mx, my), 0)

Submission status: Wrong Answer

Solution code:

W, H, x, y = map(int, input().split())
if W-x < x:
    x = W-x
if H-y < y:
    y = H-y
if x*H == y*W:   
	print(W*H/2,"1")
else:
	print(W*H/2,"0")

Submission status: Wrong Answer

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

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

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

k = max(tate,yoko)

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



print(k,ans,sep=" ")

Submission status: Wrong Answer

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

sq = (W * H) / 2

someFlg = 1

tilt = H / W

if x == W / 2:
    someFlg = 0
if y == H / 2:
    someFlg = 0

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

if y == x * tilt:
    someFlg = 0
if y == H - (x * tilt):
    someFlg = 0


if x == W / 2 and y == H / 2:
    someFlg = 1

print(str(sq) + " " + str(someFlg))

Submission status: Wrong Answer

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