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 sys
w, h, x, y = map(int, input().split())
ans = [min(x * h, (w - x) * h), min(y * w, (h - y) * w)]

if w // 2 == x and h // 2 == y:
    print(str((h * w) // 2) + ' 1')
    sys.exit()

if y == (h * x) // w or y == (-(h * x) // w) + h:
    print(str((h * w) // 2) + ' 0')
    sys.exit()

if ans[0] == ans[1]:
    print(str(max(ans)) + ' 1')
else:
    print(str(max(ans)) + ' 0')

Submission status: Wrong Answer

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

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

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
o=b/2
p=c/2
f=max(min((a-c),c),min(p,a-p))
i=max(min((a-b),b),min(o,a-o))
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 or x==0:
    print("{:.9f}".format(f),g)
elif y==h or y==0:
    print("{:.9f}".format(i),g)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(W, H, x, y):
    if W/2 == x and H/2 == y:
        return (W*H)/2, 1

    if y == H/W * x:
        return (W*H)/2, 0

    ans = max(min((W-x) * H, x*H), min(W * (H-y), W*y))
    if x == 0:
        ans = max(ans, min((W * y) / 2, W * (H-y) / 2))
    if y == 0:
        ans = max(ans, min((x * H) / 2, (W-x) * H / 2))
    return ans, 0


def main():
    W, H, x, y = read_int_n()
    print('%f %d' % slv(W, H, x, y))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

A1=max(min(x*H,(W-x)*H), min(y*W,(H-y)*W))
 
#round2
A2=0
if A1==min(x*H,(W-x)*H) and A1==min(y*W,(H-y)*W):
  A2=1
elif W==x or H==y:
  A2=1

print(A1,A2)

Submission status: Wrong Answer

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

one =  W * (H-y)
two = x * H
three = 0
same = 0
if x==0 and y==0:
  three = (W*H)/2
if x==W and y==H:
  three = (W*H)/2
if x==0 and y==H:
  three = (W*H)/2
if x==W and y==0:
  three = (W*H)/2

if W == H:
  if x==y:
    three = (W*H)/2
  elif x==(W+1)-y:
    three = (W*H)/2
  

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

print(max(one, two, three), same)

Submission status: Wrong Answer

Solution code:
n = list(map(int,input().split()))
answer2 = 0

if(n[2] == 0 or n[2] == n[0]): #x座標が0 複数
    #print("1")
    answer = min(n[1]*n[2],n[1]*(n[0]-n[2]))
    answer2 = answer2 + 1
elif(n[3] == 0 or n[3] == n[1]): #複数
    #print("2")
    answer = min(n[0]*n[3],n[0]*(n[1]-n[3]))
    answer2 = answer2 + 1
elif(n[0] < n[1]): #縦長の長方形
    #print("3")
    answer = min(n[1]*n[2],n[1]*(n[0]-n[2]))
elif(n[1] < n[0]):
    #print("4")
    answer = min(n[0]*n[3],n[0]*(n[1]-n[3]))
elif(n[0] == n[1]): #複数
    answer = min(n[0]*n[3],n[0]*(n[1]-n[3]))
    answer2 = answer2 + 1


print(answer,end=' ')
print(answer2)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def solve():
    w, h, x, y = map(int, input().split())
    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])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(h / 2, 1)
solve()

Submission status: Wrong Answer

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

cond = 1 if (y==(W/H)*x)|(y==-(H/W)*x+H) else 0
if cond == 1:
    S = max(W*H*0.5, min(x*H, (W-x)*H),min(W*y, W*(H-y)))
else:
    S = max(min(x*H, (W-x)*H), min(W*y, W*(H-y)))
print(S, cond)

Submission status: Wrong Answer

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

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

print(menseki,judge)

Submission status: Wrong Answer

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

Xeq = 0

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

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

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


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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = [int(_) for _ in input().split()]
if (2 * x == W) ^ (2 * y == H):
    f = 0
elif x in [0, W] or y in [0, H]:
    f = 0
else:
    f = 1

print(W * H / 2, f)

Submission status: Wrong Answer

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

div = 0
if x == H/2 and y==W/2 and H%2==0 and W%2==0:
    div=1
print((H*W/2.0), div)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

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

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

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

out2 = 0

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

if min(men1, men2) == min(men3, men4):
    out2 = 1
if men1 == men2 or men3 == men4:
    out2 = 1

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

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

Submission status: Wrong Answer

Solution code:
from fractions import Fraction
from collections import Counter


class RectangleCutting:
    def __init__(self):
        W, H, x, y = map(int, input().split())
        self.W = W
        self.H = H
        self.x = x
        self.y = y

    def main(self):
        hs = self.H * self.W / 2
        s = []

        for p in self.__on_lines():
            s.append(hs)

        for sv in self.__separate_straight():
            s.append(sv)

        c = Counter(s)
        if c[max(s)] > 1:
            print(max(s), 1)
        else:
            print(max(s), 0)

    def __on_lines(self):
        is_on_line = []
        # line0の傾き
        a0 = Fraction(self.H, self.W)
        # line1の傾き
        a1 = Fraction(-self.H, self.W)
        # 線上にある時, 2等分可能
        # line0について
        if self.y == a0 * self.x:
            is_on_line.append(0)
        # line1について
        if self.y == a1 * self.x + self.H:
            is_on_line.append(1)

        return is_on_line

    def __separate_straight(self):
        s = self.H * self.W
        # 縦横で分割する
        # 縦
        sv = self.x * self.H
        sv = min(sv, s - sv)

        # 横
        sh = self.y * self.W
        sh = min(sh, sh - s)

        return [sv, sh]


rectangleCutting = RectangleCutting()
rectangleCutting.main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
W,H,x,y = [int(x) for x in stdin.readline().rstrip().split()]
if W == H and x == y == (W/2):
    print((W*H) / 2,1)

elif W == H and x == y and x != (W/2):
    print(min(x,W-x) * float(H),1)
    
elif (W/2) == x and (H/2) == y:
    print((W*H)/2,1)

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

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

elif (W/H) == (x/y):
    print((W*H)/2,0)
    
else:
    squ1 = min(x,W-x) * float(H)
    squ2 = min(y,H-y) * float(W)
    print(max(squ1,squ2),0)

Submission status: Wrong Answer

Solution code:
W,H,x,y=(float(i) for i in input().split())
x=min(x,W-x)
y=min(y,H-y)
Sx=H*x
Sy=W*y
S=[Sx,Sy]
hoge=0
d=x*H+y*W
if d==W*H:
  S.append(W*H/2)
  if x*H==y*W:
    hoge=1
S.sort()
if S[1]==S[0]:
  hoge=1
print(min(S),hoge)

Submission status: Wrong Answer

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


if W * y > -H * x + W * H:
    x *= -1
    y *= -1


def is_center():
    return x * 2 == W and y * 2 == H


def is_on_axis():
    return not is_center() and any([
        x * 2 == W,
        y * 2 == H,
        W * y == -H * x + W * H,
        W * y == H * x,
    ])


if is_center():
    S = W * H / 2
    T = 1
elif is_on_axis():
    S = W * H / 2
    T = 0
else:
    S = max([
        x * (H ** 2) / (H - y) / 2,
        W * (x * y / (W - x) + y) / 2,
    ])
    T = 0

print(str(S) + " " + str(T))

Submission status: Wrong Answer

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

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

print(ans,ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
W, H, x, y = map(int, input().split())
if (x == 0 or x == W) and ( y == 0 or y == H):
    print(H*W/2, 0)
    exit()
tmp1 = min(x*H, (W-x) * H)
tmp2 = min(W*y, W*(H-y))
e = 0
if tmp1 == tmp2:
    e = 1
print(float(max(tmp1, tmp2)), e)

Submission status: Wrong Answer

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

if x==w/2 and y==h/2:
    print(w*h/2)
    print(1)

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

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

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

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

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

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

Submission status: Wrong Answer

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

rect1 = x * H
rect2 = (W-x) * H

rect3 = W * y
rect4 = W * (H-y)

if abs(rect1-rect2) > abs(rect3-rect4):
  ans1 = min(rect3,rect4)
else:
  ans1 = min(rect1,rect2)

if W == H and x == y:
  ans2 = 1
else:
  ans2 = 0

print(ans1,ans2)

Submission status: Wrong Answer

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

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

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("{:.11f}".format(ans), int(a == b))

Submission status: Wrong Answer

Solution code:
def solve():
    w, h, x, y = map(int, input().split())
    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])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(w / 2, 0)
solve()

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 and y == 0:
                ans = H*W/2
        elif x == 0:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
elif min_d == d_45_plus:
        if x <= W/2:
                x += (W/2-x)*2
        else:
                x -= (x-W/2)*2
        if x == 0:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        elif y/x >= H/W:
                ans = (H-(y-(H/W)*x))*(W-(W/H)*y+x)/2
        else:
                ans = (H-(x-(W/H)*y))*(H+y-(W/H)*x)/2
if smflg:
        smstr = '1'
else:
        smstr = '0'

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

print(str('{:.20g}'.format(ans)) + ' ' + smstr)

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

Submission status: Wrong Answer

Solution code:
w,h,x,y = map(int, input().split())
p = 0
if (x==0)|(x==w)|(y==0)|(y==h):
  mens = w*h/2
  p = 0
elif (x==(w/2))|(y==(h/2)):
  mens = w*h/2
  if (x==(w/2))&(y==(h/2)):
    p = 1
  else:
    p = 1
elif ((x/y)==(w/h))|(y == -(h/w)*x+h):
  p = 1
  mens = w*h/2
else:
  if ((y<h/w*x)&(y<-(h/w)*x+h))|((y>h/w*x)&(y>-(h/w)*x+h)):
    p = 0
    mens = min(x,w-x)*h
  else:
    p = 0
    mens = min(y,h-y)*w
print(mens, p)

Submission status: Wrong Answer

Solution code:
def solve():
    w, h, x, y = map(int, input().split())
    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])
    if ans:
        print(max(ans), int(ans.count(max(ans)) != 1))
    else:
        print(h / 2, 0)
solve()

Submission status: Wrong Answer

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

if w-x > w//2:
    num.append(x * h)
else:
    num.append((w-x) * h)

if h-y > h//2:
    num.append(w * y)
else:
    num.append(w * (h-y))

ans.append('{:.9f}'.format(max(num)))

if len(set(num)) < len(num):
    ans.append(1)
else:
    ans.append(0)

print(*ans, sep=' ')

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)
elif h/w == y/x or w/h == x/y:
    if w/2 == x and h/2 == y:
        print(w*h/2, 1)
    else:
        print(w*h/2, 0)
else:
    if mx == my:
        print(mx, 1)
    else:
        print(max(mx, my), 0)

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 = [ W * H ] if y == 0 or y == H else [y * W, (H - y) * W]
    v = [ W * H ] if x == 0 or x == W else [H * x, (W - x) * H]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Rectangle = W * H

if x == W and y == H:
    print(Rectangle/2, ' ', 0)
    exit()

if x == 0 and y == 0:
    print(Rectangle/2, ' ', 0)
    exit()

if x == W and y == 0:
    print(Rectangle/2, ' ', 0)
    exit()
if y == H and x == 0:
    print(Rectangle/2, ' ', 0)
    exit()

if y == 0:
    print(max(y, H-y) * W/2, ' ', 0)
    exit()
if x == 0:
    print(max(x, W-x) * H/2, ' ', 0)
    exit()


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

# xで分割する場合と, yで分割する場合がある
Rectangle_cuts = []

Rectangle_cuts.append(x*H)
Rectangle_cuts.append((W-x)*H)
Rectangle_cuts.append(W*y)
Rectangle_cuts.append(W*(H-y))

hoge = min(Rectangle_cuts[0], Rectangle_cuts[1])  # xに垂直な線を引いて分割して、小さい方
fuga = min(Rectangle_cuts[2], Rectangle_cuts[3])  # yに垂直な線を引いて分割して、小さい方

if hoge == fuga:
    print(hoge, ' ', 1)
else:
    print(max(hoge, fuga), ' ', 0)

Submission status: Wrong Answer

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

flag = '0'
size = 0

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

elif w == x or x == 0:
	size = min(x*y, w*h-x*y)

elif h == y or y == 0:
	size = min(x*y, w*h-x*y)

else:
	size1 = x * h
	size2 = (w - x) * h
	size3 = w * y
	size4 = w * (h - y)

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

	if min_size1 == min_size2:
		flag = '1'
		size = min_size1

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


print(size, flag)

Submission status: Wrong Answer

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

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

if S1 == S2:
    print('{:.9f}'.format(S1), 1)
else:
    print('{:.9f}'.format(max(S1, S2)), 0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Rectangle = W * H

if x == W and y == H:
    print(Rectangle/2, ' ', 0)
    exit()

if x == 0 and y == 0:
    print(Rectangle/2, ' ', 0)
    exit()

if x == W and y == 0:
    print(Rectangle/2, ' ', 0)
    exit()
if y == H and x == 0:
    print(Rectangle/2, ' ', 0)
    exit()

if y == 0:
    print(max(y, H-y) * W/2, ' ', 0)
    exit()
if x == 0:
    print(max(x, W-x) * H/2, ' ', 0)
    exit()


# if x == int(W/2) and y == int(H/2):
#     print(Rectangle/2, ' ', 1)
#     exit()

# xで分割する場合と, yで分割する場合がある
Rectangle_cuts = []

Rectangle_cuts.append(x*H)
Rectangle_cuts.append((W-x)*H)
Rectangle_cuts.append(W*y)
Rectangle_cuts.append(W*(H-y))

hoge = min(Rectangle_cuts[0], Rectangle_cuts[1])  # xに垂直な線を引いて分割して、小さい方
fuga = min(Rectangle_cuts[2], Rectangle_cuts[3])  # yに垂直な線を引いて分割して、小さい方

if hoge == fuga:
    print(hoge, ' ', 1)
else:
    print(max(hoge, fuga), ' ', 0)

Submission status: Wrong Answer

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



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

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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
    else:
        tmp = h / x * y * 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
    else:
        tmp = h / x * (h - y) * h / 2
    area.append(min(tmp, a - tmp))

if x != 0:
    if w / x * y <= h:
        tmp = w / x  * y * w / 2
    else:
        tmp = w / y * x * 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
    else:
        tmp = w / y * (w - x) * 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:
W,H,x,y = map(int,input().split())
tate_l = x*H
tate_r = (W-x)*H
yoko_d = y*W
yoko_u = (H-y)*W
tatemin = min(tate_l,tate_r)
yokomin = min(yoko_d,yoko_u)
if x == 0 and y == 0:
  print(0,0)
if tatemin < yokomin:
  print(yokomin,0)
elif tatemin > yokomin:
  print(tatemin,0)
else:
  print(tatemin,1)

Submission status: Wrong Answer

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

LD = x * y
LU = x * (H - y)
RD = (W - x) * y
RU = (W - x) * (H - y)

L = LD + LU
R = RD + RU
U = LU + RU
D = LD + RD

minS = min(L, R, U, D)

if (L == R) or (L == D) or (L == U) or (R == D) or (R == U) or (D == U):
  p = 1
else:
  p = 0
  
print(minS, p)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
w,h,x,y = map(int,input().split())
flag = 0
if w == 2*x and w == 2*y:
    flag = 1
if w%2 == 1 and h%2 == 1:
    p = ".5"
else:
    p = ""

print (str(int(h*w/2))+p+" "+str(flag))

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 and 0 < y < h:
        if w == 1 and h == 1:
            print(s, 0)
            exit()

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

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

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

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

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

out2 = 0

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

if min(men1, men2) == min(men3, men4):
    out2 = 1

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

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

Submission status: Wrong Answer

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

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


#if min(x*H, (W-x)*H) == min(W*y, (H-y)*W):
if minseki == (x*H or (W-x)*H) and minseki == (W*y or (H-y)*W):
    cnt += 1

print(minseki, cnt)

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)
s = max(p, q)
flag = 0

if p < q:
    if s == a and s == b:
        flag = 1
else:
    if s == c and s == d:
        flag = 1
'''
if [x, y] == [0, 0] or [x, y] == [0, H] or [x, y] == [W, 0] or [x, y] == [W, H]:
    s = 0
    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 = (int(c) for c in input().split())

if x == w and y == h:
    print(x * h)
    print(1)

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

Submission status: Wrong Answer

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

if W==x or H==y or x==0 or y==0:
    print(str(W*H/2) + ' 0')
elif 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 = map(float, input().split())



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

    a = 0.0
    f = 0
    if v1 < v2:
        a = v2
    elif v1 > v2:
        a = v1
    else:
        a = v1
        f = 1

    print(a, f)