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: Runtime Error

Solution code:
def solve():
    w, h, x, y = map(float, 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(0, 1)
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Runtime Error

Solution code:
w,h,x,y = map(int, input().split())
men = float(w * h / 2)
r1 = float(w/x)
r2 = float(h/y)
if (r1 == 2) and (r2 == 2):
    han = 1
else:
    han = 0
print("{} {}".format(men,han))

Submission status: Runtime Error

Solution code:
def solve():
    w, h, x, y = map(float, 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(0, 0)
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())

a=list(map(int,input().split()))
sowa=[]
for i in range(1,n+1):
    sowa.append(sum(a[:i]))
ans=0
for i in range(n):
    if sowa[i]>=k:
        ans+=1
        for j in reversed(range(i)):
            bubun=sowa[i]-sowa[j]
            if bubun>=k:
                ans+=j+1
                break
print(ans)

Submission status: Runtime Error

Solution code:
def inpl(): return list(map(int, input().split()))
W, H, x, y = inpl()
if x*2 > W:
    x = W-x
if y*2 > H:
    y = H-y

a = W*y
b = H*x
if x == 0 or y == 0:
    print(H*W/2, 0)
elif W*y == H*x:
    print(H*W/2, int(W==2*x))
    raise
elif a == b:
    print(a, 1)
elif a > b:
    print(a, 0)
else:
    print(b, 0)

Submission status: Runtime Error

Solution code:
import sys

input = sys.stdin.readline


def main():
    W, H, x, y = [int(i) for i in input().split()]
    min_x = 0
    min_y = 0
    areas = []
    if 0 < x < W:
        area_a = x * (H - min_y)
        area_b = (W - x) * (H - min_y)
        areas.append(min([area_a, area_b]))

    if 0 < y < H:
        area_a = (W - min_x) * y
        area_b = (W - min_x) * (H - y)
        areas.append(min([area_a, area_b]))

    print(max(areas), int(len(set(areas)) == 1))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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 (h/w)==(y/x):
    menseki=(w*h)/2
    judge=0
elif y==-(w/h)*x+w:
    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=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: Runtime Error

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  Y == 1:
    k = 0.5
    ans = 0


print(k,ans,sep=" ")

Submission status: Runtime Error

Solution code:
W, H, x, y = (int(i) for i in input().split())
area = 0
possible = 0
for b in range(H+1):
    A = ((y - b)/x * W + 2 * b) * W / 2
    B = W * H - A
    targetArea = min(A, B)
    if area == targetArea:
        possible = 1
    elif area < targetArea:
        possible = 0
        area = targetArea

for b in range(W+1):
    A = ((x - b)/y * H + 2 * b) * H / 2
    B = W * H - A
    targetArea = min(A, B)
    if area == targetArea:
        possible = 1
    elif area < targetArea:
        possible = 0
        area = targetArea

print(area, possible)

Submission status: Runtime Error

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


xxx = x
yyy = y
if (x/w > y/h):
    xxx = y
    yyy = x
    
############
#print(xxx,yyy)

a = xxx*h
b = yyy*w
c = w*w*(h-yyy)/(w-xxx)/2

mmm = w*h

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

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

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

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1;a = 2/0
print(w*h/2,num)

Submission status: Runtime Error

Solution code:
W, H, x, y = map(int, 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
        print(ans, ans_2)
else:
    # 0 0
    _y = y*W/x
    _x = W
    if _y > H:
        _y = H
        _x = x*H/y
    a_00 = _x*_y/2

    # H 0
    _y = H
    _x = x * H / (H-y)
    if _x > W:
        _x = W
        _y = (H-y)*W/x
    a_H0 = _x*_y/2

    # 0 W
    _y = y*W/(W-x)
    _x = W
    if _y > H:
        _y = H
        _x = H*(W-x)/y
    a_0W = _x*_y/2

    # H W
    _y = H
    _x = (W-x)*H/(H-y)
    if _x > W:
        _x = W
        _y = (H-y)*W/(W-x)
    a_HW = _x*_y/2

    yoko_a = W * y
    yoko_b = W * (H-y)
    yoko = float(min(yoko_a, yoko_b))

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

    a = [a_HW, a_H0, a_0W, a_00, yoko, tate]
    a = sorted(a)
    print(a[-1])
    if a[-1] == a[-2]:
        print(1)
    else:
        print(0)

Submission status: Runtime Error

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 (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: Runtime Error

Solution code:
W,H,x,y = map(int,input().split())
ans1 = (W-x) * H
ans2 = (H-y) * W
if ans1 == ans2:
    print(float(ans1),1)
if ans1 > ans2:
    print(float(ans2),0)
if ans2 > ans1:
    print(float(ans1,0))

Submission status: Runtime Error

Solution code:
w,h,x,y = map(int, input().split())
men = float(w * h / 2)
r1 = float(w/x)
r2 = float(h/y)
if w/x == h/y:
    han = 1
else:
    han = 0
print("{} {}".format(men,han))

Submission status: Runtime Error

Solution code:
W,H,x,y = map(int,input().split())
ans1 = (W-x) * H
ans2 = (H-y) * W
if ans1 == ans2:
    print(float(ans1),1)
if ans1 > ans2:
    print(float(ans1),0)
if ans2 > ans1:
    print(float(ans2,0))

Submission status: Runtime Error

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

# 0 0
_y = y*W/x
_x = W
if _y > H:
    _y = H
    _x = x*H/y
a_00 = _x*_y/2

# H 0
_y = H
_x = x * H / (H-y)
if _x > W:
    _x = W
    _y = (H-y)*W/x
a_H0 = _x*_y/2

# 0 W
_y = y*W/(W-x)
_x = W
if _y > H:
    _y = H
    _x = H*(W-x)/y
a_0W = _x*_y/2

# H W
_y = H
_x = (W-x)*H/(H-y)
if _x > W:
    _x = W
    _y = (H-y)*W/(W-x)
a_HW = _x*_y/2

yoko_a = W * y
yoko_b = W * (H-y)
yoko = float(min(yoko_a, yoko_b))

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

a = [a_HW, a_H0, a_0W, a_00, yoko, tate]
a = sorted(a)
print(a[-1])
if a[-1] == a[-2]:
    print(1)
else:
    print(0)

Submission status: Runtime Error

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 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 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'
print(str(ans) + ' ' + smstr)

Submission status: Runtime Error

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

    if x == 0 and y ==0 :
        out1 = w * h
        out2 = 1
    else:
        #print("{0} {1} {2} {3}".format(str(men1), str(men2), str(men3), str(men4)))

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

        if 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: Runtime Error

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

Submission status: Runtime Error

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

Ss, Ss_Sub = [], []

for i in range(1,x+1): Ss.append(i * H)
for i in range(1,y+1): Ss.append(i * W)
for i in range(len(Ss)): Ss_Sub.append(abs(S - 2 * Ss[i]))

c = sorted(zip(Ss_Sub, Ss))
Ss_Sub, Ss = zip(*c)

print('{:.6f}'.format(Ss[0]),end="")

min_value = Ss_Sub[0]
cnt = 0
for value in list(Ss_Sub):
    if min_value >= value:cnt += 1
    if cnt == 2: print(" 1"); break
    if min_value < value:print(" 0"); break

Submission status: Runtime Error

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 (((W % x == 0) and (H % y ==0)) 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

# 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: Runtime Error

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




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


S=w*h/2

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

Submission status: Runtime Error

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

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

if (W - x) / x == y / (H - y) and (x * 2 != W and y * 2 != H):
    print("{:10f}".format((W * H) / 2), 0)
    quit()
if x / (W - x) == y / (H - y) and (x * 2 != W and y * 2 != H):
    print("{:10f}".format((W * H) / 2), 0)
    quit()

if min(size[0]) > min(size[1]):
    if x * 2 == W and y * 2 == H:
        print("{:10f}".format(min(size[0])), 1)
    else:
        print("{:10f}".format(min(size[0])), 0)
else:
    if x * 2 == W and y * 2 == H:
        print("{:10f}".format(min(size[1])), 1)
    else:
        print("{:10f}".format(min(size[1])), 0)

Submission status: Runtime Error

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

if x == 0 and y ==0:
    out1 = w * h
    out2 = 1
else:
    print("{0} {1} {2} {3}".format(str(men1), str(men2), str(men3), str(men4)))

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

    if 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: Runtime Error

Solution code:
size = [[x * H, (W - x) * H], [W * y, W * (H - y)]]

if (W - x) / x == y / (H - y) and (x * 2 != W and y * 2 != H):
    print("{:10f}".format((W * H) / 2), 0)
    quit()
if x / (W - x) == y / (H - y) and (x * 2 != W and y * 2 != H):
    print("{:10f}".format((W * H) / 2), 0)
    quit()

if min(size[0]) > min(size[1]):
    if x * 2 == W and y * 2 == H:
        print("{:10f}".format(min(size[0])), 1)
    else:
        print("{:10f}".format(min(size[0])), 0)
else:
    if x * 2 == W and y * 2 == H:
        print("{:10f}".format(min(size[1])), 1)
    else:
        print("{:10f}".format(min(size[1])), 0)

Submission status: Runtime Error

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 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: Runtime Error

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

Submission status: Runtime Error

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

if w == h:
    print('{:.6f}'.format(f),end = "")
    print(" " + str(1))
else:
    f = w*h/2
    print('{:.6f}'.format(f),end = "")
    print(" " + str(0))

Submission status: Runtime Error

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 (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: Runtime Error

Solution code:
def inpl(): return list(map(int, input().split()))
W, H, x, y = inpl()
if x > W/2:
    x = W-x
if y > H/2:
    y = H-y

a = W*y
b = H*x
if W/H == x/y:
    print(H*W/2, int(W/2==x))
elif a == b:
    print(a, 1)
elif a > b:
    print(a, 0)
else:
    print(b, 0)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

################################################################################

a, b, x, y = map(int, input().split())


if b/a*x < y:
    x, y = a-x, b-y

areas = [
    min(x, a-x) * b,
    min(y, b-y) * a,
    y/x*a*a*0.5,
]

a, b = b, a
x, y = y, x

if b/a*x < y:
    x, y = a-x, b-y

areas.append(y/x*a*a*0.5)

areas.sort()
print(areas[-1], 1 if areas[-2] == areas[-1] else 0)

Submission status: Runtime Error

Solution code:
W , H , x , y = map(int,input().split())
if x == 0 or x == W:
	x_on_line = True
else:
	x_on_line = False
if y == 0 or y == H:
	y_on_line = True
else:
	y_on_line = False


if x_on_line or y_on_line:
	pattern = 0
	S = W * H / 2
else:
	if (W / 2) == float(x):
		x_half_point = True
	else:
		x_half_point = False
	if (H / 2) == float(y):
		y_half_point = True
	else:
		y_half_point = False
	if x_half_point and y_half_point:
		pattern = 1
		S = W * H / 2
	elif x_half_point or y_half_point:
		pattern = 0
		S = W * H / 2	
	else:
		min_x = (x,W - x)
		min_y = (y,H - y)
		S = max((min_x * H,min_y * W))
		pattern = 0
print(S,pattern)

Submission status: Runtime Error

Solution code:
o1 = (w * h) / 2

l = []
a = h / w

for i in range(h+1):
  l.append((i, w / h * i))
  l.append((i, - h / w * i + h))

if (x, y) in l:
  o2 = 1
else:
  o2 = 0
  
print(o1, o2)

Submission status: Runtime Error

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


num = 0

if w%2 is 0 and h%2 is 0:
  if w//2 is x and h//2 is y:
  	num = 1;num = 2/0
print(w*h/2,num)

Submission status: Runtime Error

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

if h/w == y/x:
	ans = '1'
	area = h * w / 2
else:
	ans = '0'
	if w > h:
		area = min(w*y,w*(h-y))
	else:
		area = min(h*x,h*(w-x))
print(area, ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
W, H, x, y = map(int, input().split())
f = "0"
if (W != x and H != y and W != 0 and H != 0) and (W/x == H/y or (W-x)/x == H/ y or x == y):
    f="1"
print(str(W*H/2) + " " + f)

Submission status: Runtime Error

Solution code:
N,K=(int(x) for x in input().split())
A=list(map(int,input().split()))
count=0
for n in range(N):
    if A[n]>=K:
        count=count+1
S= [[0]*N for _ in range(N)]
for i in range (N-1):
    S[i][i+1]=A[i]+A[i+1]
    if S[i][i+1]>=K:
        count=count+1
    for j in range(i+2,N):
        S[i][j]=S[i][j-1]+A[j]
        if S[i][j]>=K:
            count=count+(N-j)
            break
print(count)

Submission status: Runtime Error

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

l = []
for h_i in range(1, h+1):
    for w_i in range(1, w+1):

        # 三角形(0, w, y)の面積
        #t_wy = (w_i*y) / 2

        # 三角形(0, x, h)の面積
        #t_xh = (x*h_i) / 2
        
        # 長方形の面積
        s_wy = w_i*y
        s_xh = x*h_i

        if w_i <= x:
            l.extend([s_wy, s_xh])
        #print('wの面積', t_wy) 
        #print('hの面積', t_xh)
        #print('wの長方形', s_wy) 
        #print('hの長方形', s_xh)
        #print('w, h', w_i, h_i)
print(max(l))

# maxが複数あるか
if len([i for i, x in enumerate(l) if x == max(l)]) >= 1:
    print(0)
else:
    print(1)

Submission status: Runtime Error

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

pattern = 1
if w/2 == x and h/2 == y:
    pettern = 1
elif w/2 == x or h/2 == y:
    pettern = 0

print("{} {}".format(w*h/2, pettern))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if W/2 == x and H/2 == y:
    ans_men = (W * H) / 2
    dif = 1
elif W/2 == x or H/2 == y:
    ans_men = (W * H) / 2
elif W/2 <= x:
    ans_men1 = (W - x) * H
    ans_men2 = x * H
    ans_men3 = (H - y) * W
    ans_men4 = y * W
    Ans_men = [ans_men1, ans_men2, ans_men3, ans_men4]
    Ans_men.sort()
    ans_men = Ans_men[3]

print(ans_men, dif)

Submission status: Runtime Error

Solution code:
w,h,x,y=map(int,input().split())
area=0
count=0
if w/x==2:
    if h/y==2:
        count=1
        area=h*x
    else:
        count=0
        area=h*x
if h/y==2:
    if w/x==2:
        count=1
        area=w*y
    else:
        count=0
        area=w*y
if x>y and w/x!=2 and h/y!=2:
    count=0
    area=w*y
if x<y and w/x!=2 and h/y!=2:
    count=0
    area=h*x
if x==y and w/x!=2 and h/y!=2:
    if w==h:
        count=1
        area=h*x
    if w>h:
        count=0
        area=h*x
    if w>h:
        count=0
        area=w*y
if x==0 and y==0:
    count=1
    area=w*h/2
    
area='{:.9g}'.format(area)
l=[]
l.append(str(area))
l.append(" ")
l.append(str(count))
print(''.join(l))

Submission status: Runtime Error

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

flag = '0'
size = 0

if (w==x and h==y) or (x==0 and y==0):
	size = x*y
	flag = '1'
elif w == x and h != y:
	size = min(x*y, x*(h-y))
elif h == y and w != x:
	size = min(x*y, (w-x)*y)
else:
	size1 = x * h
	size2 = (w - x) * h
	size3 = w * x
	size4 = w * (h - y)

	min_size1 = min(size1, size2)
	min_size2 = min(size3, size4)

	if min_size1 == min_size2:
		flag = '1'

	if min_size1 < min_size2:
		size = min_size2
	else:
		size = min_size1


print(min_size1)
print(min_size2)
print(size, flag)

Submission status: Runtime Error

Solution code:
def solve():
    w, h, x, y = map(float, input().split())
    if x == 0 or x == w or y == 0 or y == h:
        print(h * w / 2, 0)
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Runtime Error

Solution code:
w,h,x,y=map(int,input().split())
if x!=0 and x!=w and y!=0 and y!=h:
 a=min(w-x,x)
 b=min(y,h-y)
 ans1=max(a*h,b*w)
 if a*h==b*w:
  ans2=1
 else:
  ans2=0
 print(ans1,ans2)
else:
  break

Submission status: Runtime Error

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

if W/2 == x and H/2 == y:
    ans_men = (W * H) / 2
    dif = 1
elif W/2 == x or H/2 == y:
    ans_men = (W * H) / 2
elif W/2 <= x:
    ans_men1 = (W - x) * H
    ans_men2 = x * H
    ans_men3 = (H - y) * W
    ans_men4 = y * W
    Ans_men = [ans_men1,ans_men2,ans_men3,ans_men4]
    Ans_men.sort()
    ans_men = Ans_men[0]

print(ans_men, dif)

Submission status: Runtime Error

Solution code:
W,H,x,y=map(int,input().split())
men=W*H/2
a=float(y/x)
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:
        cross=1
    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: Runtime Error

Solution code:
def solve():
    w, h, x, y = map(float, input().split())
    if x == 0 or x == w or y == 0 or y == h:
        print(h * w / 2, 1)
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Runtime Error

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

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

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

elif y/x == h/w:
  way=0
  s=w*h/2

else:
  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: Runtime Error

Solution code:
W, H, x, y = map(int, input().split())
jufuku = 0
if x == 0 and y == 0:
    if y / x == H / W:
        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: Runtime Error

Solution code:
# coding: utf-8
# Your code here!


import sys

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

if(W%x==0 and H%y==0):
    
    #print (hoge)
    print("{:.100f}".format(hoge/2),1)
    #print ((W*H)/2,1)

else:
    #print (W*H/2,1)
    print("{:.100f}".format(hoge/2),0)

Submission status: Runtime Error

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

W_difference = ((W / 2) - x) ** 2
H_difference = ((H / 2) - y) ** 2

another_solution = 0

if W_difference == H_difference:
    another_solution = 1
elif W_difference > H_difference:
    area = y * W
else:
    area = x * H

print('{:.6f} {}'.format(area, another_solution))

Submission status: Runtime Error

Solution code:
def solve():
    w, h, x, y = map(float, input().split())
    if x == 0 or x == w or y == 0 or y == h:
        print(min(h, w) / 2, 1)
    ans = []
    if y != 0:
        ans.append(sorted((w * y, w * (h - y)))[0])
    if x != 0:
        ans.append(sorted((h * x, h * (w - x)))[0])
    print(max(ans), int(ans.count(max(ans)) != 1))
solve()

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
"""考え方
よくわからんけど、縦か横の直線で分割する？
あと原点から(x,y)座標へ向けて斜めに分割する奴も考える

"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    # 縦に分割する場合
    ans1 = min(x*H, (W-x)*H)

    # 横に分割する場合
    ans2 = min(W*y, W*(H-y))

    # 斜めに分割する場合
    d = y/x
    if d <= 1:
        # 傾きが1以下の場合
        ans3 = W * (W*d) / 2
    else:
        # 傾きが1より大きい
        d = x/y
        ans3 = H * (H*d) / 2

    ans = max(ans1, ans2, ans3)

    if ((ans==ans1 and ans1==ans2) or 
       (ans==ans2 and ans2==ans3) or 
       (ans==ans3 and ans3==ans1)):
        is_multi = 1
    else:
        is_multi = 0

    print(ans, is_multi)


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
W, H, x, y = map(int, input().split())
jufuku = 0
if (x == 0 and y == 0) or y / x == H / W:
    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: Runtime Error

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

a = min(x,w-x)
s = h*a

b = min(y, h-y)
t = w*b

result = 0

if x == w/2 and y == h/2:
    result = 1

u = 0
if w == x and h == y:
    u = w*h/2
if x == 0 and y == h:
    u = w*h/2
if x == 0 and y == 0:
    u = w*h/2
if x == w and y == 0:
    u = w*h/2
 
v = 0
if x == 0 or x == w:
    temp = max(h-y,y)
    v = h*w/2

c = 0
if y/x == h/w:
    c = h*w/2

z = 0
try:
    if y == -h/w*x + h:
        z = h*w/2
except:
    pass

print(max(s,t,u,v,c,z),result)

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
"""考え方
よくわからんけど、縦か横の直線で分割する？
あと原点から(x,y)座標へ向けて斜めに分割する奴も考える

"""
def solve():
    W, H, x, y = list(map(int, input().split()))

    # 縦に分割する場合
    ans1 = min(x*H, (W-x)*H)

    # 横に分割する場合
    ans2 = min(W*y, W*(H-y))

    # 斜めに分割する場合
    d = y/x
    if d <= 1:
        # 傾きが1以下の場合
        ans3 = W * (W*d) / 2
    else:
        # 傾きが1より大きい
        d = x/y
        ans3 = H * (H*d) / 2

    ans = max(ans1, ans2, ans3)

    if ((ans==ans1 and ans1==ans2) or 
       ((ans==ans2 and ans2==ans3) or 
       ((ans==ans3 and ans3==ans1)):
        is_multi = 1
    else:
        is_multi = 0

    print(ans, is_multi)


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

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: Runtime Error

Solution code:
li = list(map(int,input().split()))

S1 = min(l1[0] * li[3], l1[0] * (li[1] - li[3]))
S2 = min(li[2] * li[1], (li[0] - li[2]) * li[1])

if S1 == S2:
    print(S1, 1)
else:
    print(min(S1, S2), 0)

Submission status: Runtime Error

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

area1 = H*x
area2 = H*(W-x)
comp1 = min(area1,area2)

area3 = W*y
area4 = W*(H-y)
comp2 = min(area3,area4)

flag = 1 if comp1==comp2 else 0
print(f"{max(comp1,comp2)} {flag}")

Submission status: Runtime Error

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 w==(W-x):
    print("{:.9f}".format(menseki), '1')
else:
    print("{:.9f}".format(menseki), '0')

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1e9)

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: Runtime Error

Solution code:
W,H,x,y=map(int,input().split())
men=W*H/2
a=y/x
b=H/W
W2=W/2
H2=H/2
cross=0
if a == b or x == W2 or y == H2:
    if a == b:
        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: Runtime Error

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