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:
[w,h,x,y]=[int(i) for i in input().split()]


if x*2==w and y*2==h:
    ans=int(1)
else ans=int(0)

print(double(w*h/2)+" "+ans)

Submission status: Runtime Error

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


if x*2=w and y*2=h:
    ans=int(1)
else ans=int(0)

print(double(w*h/2)+" "+ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a,b,x,y = input().rstrip().split(' ')
r = 0
if x + x == a and y + y == b:
    r = 1
print(a*b/2,r)

Submission status: Runtime Error

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

print(X*H/2)

if x*2==W and y*2==H:
  print(1)
else:
  print(0)

Submission status: Runtime Error

Solution code:
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("POSSIBLE")
    elif q == 0:print("IMPOSSIBLE")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n = ip()                                     #入力整数1つ
n,m,x,y= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!

print((n*m)/2,end =' ')
if n 2*x or m == y*2:
    print(1)
else: print(0)

Submission status: Runtime Error

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

if x in [0, W] and y in [0, H]:
    S = 0
    print(0, 1)
    exit()

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

if x in [0, W]:
    S = W * min(y, H - y)
    print(S, 0)
    exit()

if y in [0, H]:
    S = min(x, W - x) * H
    print(S, 0)
    exit()

X1 = x
X2 = (W - x)
Y1 = y
Y2 = (H - y)

X = min(X1, X2)
Y = min(Y1, Y2)

if X * H == W * Y:
    multi = 1

S = max(X * H, W * Y)

print(S, multi)

Submission status: Runtime Error

Solution code:
w,h,x,y = map(int,int.split())
flag = 0
if (x/W)==(y/W):
  flag = 1
print((w*h)/2,flag)

Submission status: Runtime Error

Solution code:
w, h, x, y = list(map(int, input().split()))
print(w * h / 2, 1 int((w==x*2) and (h==y*2)))

Submission status: Runtime Error

Solution code:
2 2 1 1

Submission status: Runtime Error

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

# print(W, H, x, y)

multi = 0

# print(x / W, y / H)

if x / W == y / H:
    multi = 1
elif x / W <= y / H:
    S = x * H
elif x / W >= y / H:
    S = W * y

print(S, multi)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
int main(){
    long int W, H, x, y, ans;
    scanf("%ld %ld %ld %ld",&W,&H,&x,&y);
    if(2*x==W && 2*y==H){
        ans = 1;
    }
    else{
        ans = 0;
    }
    printf("%lf %ld\n", W*H/2.0, ans);

    return 0;
}

Submission status: Runtime Error

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

if a.count(max(a)) > 1:
    print('{:.6f}'.format(w*h/2,1)
else:
    print('{:.6f}'.format(w*h/2,0)

Submission status: Runtime Error

Solution code:
hx = h * x
hx2 = h * (w-x)
wy = w * y
wy2 = w * (h-y)

if(hx > hx2) :
    d1 = hx2
else :
    d1 = hx

if(wy > wy2) :
    d2 = wy2
else :
    d2 = wy


if(d1 == d2) :
    ff = 1
else :
    ff = 0

if(d1 > d2) :
    print(str(d1) + " " + str(ff))
else :
    print(str(d2) + " " + str(ff))

Submission status: Runtime Error

Solution code:
W,H,x,y = map(int,input().split())
K.append((W*H)/2)
if x == W/2 and y == H/2:
  K.append(1)
else:
  K.append(0)
print(K[0],K[1])

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    double w = get<double>(), h = get<double>(),
        x = get<double>(), y = get<double>();

    bool multi = 2*x == w && 2*y == h;
    cout << h*w/2 << " " << multi << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
W, H, x, y = map(int, input().split())
a = H * (W - x)
b = H * W - H * (W - x)
c = W * (H - y)
d = H * W - W * (H - y)

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

else:
e = 0

if a <= b:
    if c <= d:
        if a <= c:
            print(c, e)
        else:
            print(a, e)
    else:
        if a <= d:
            print(d, e)
        else:
            print(a, e)
else:
    if c <= d:
        if b <= c:
            print(c, e)
        else:
            print(b, e)
    else:
        if b <= d:
            print(d, e)
        else:
            print(b, e)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%d %d'%(inp[0]*inp[1]*0.5,ans))
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))
提出情報

Submission status: Runtime Error

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

if w/2.0 == float(x) and h/2.0 == float(y):
    print(w*h/2.0,1)
else:
    print(w*h/2.0,0)

Submission status: Runtime Error

Solution code:
W, H, x, y = map(float, input().split())
if x == W/2 & y == H/2:
  chohuku = 1
else:
  chohuku = 0
print(str((H*W)/2) + " " + str(chohuku))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

cnt = 0
for i in range(N):
    for j in range(N-i):
        s = sum(A[i:i+j+1])
        if s >= K:
            cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
a = [int(x) for x in input().split()]

start = 0
end = 0
a_sum = a[0]

ans = 0
#右に進めるだけ進む ->  a_sum >= Kを満たすまで
#左を詰めていく -> a_sum >= K の間だけ

#右端までいったらbreak



while True:
    if a_sum < K:
        end += 1
        if end == N:
            break

        #新たに追加した最後の数字を追加
        a_sum += a[end]

    else:
        #もしK以上の場合、end以降の全ての要素が追加されても満たすため、その数を足す
        #その数はこの場合、N - end  ex:10個あってa[2]~a[5]個で満たしているとき、 2~a[6], a[7], a[8], a[9]とあって計 N - 5個
        ans += N - end

        #左を詰める
        a_sum -= a[start]
        start += 1

print(ans)

Submission status: Runtime Error

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

S = W * H / 2

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

if 
print(S, flag)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
W,H,x,y=map(int,input().split())
if x=W/2 and y=H/2:
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
"""else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)"""

Submission status: Runtime Error

Solution code:
W,H,x,y=map(int,input().split())
if x=W/2 and y=H/2
    print(W*H/2,1)
elif not x or not y:
    print(W*H/2,0)
elif x/W==y/H or x/W==(H-y)/H:
    print(W*H/2,0)
else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),0)
"""else:
    print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W),min(H*H*x/y,H*W-H*H*x/y),min(W*W*y/x,H*W-W*W*y/x)),0)"""

Submission status: Runtime Error

Solution code:
w,h,x,y = map(int,input.split())
s = float((w*h) / 2)
if x+x==w and y+y ==h:
  print(s+"1")
else:
  print(s + "0")

Submission status: Runtime Error

Solution code:
w,h,x,y = map(int,input.split())
s = float((w*h) / 2)
if x==y:
  print(s+"1")
else:
  print(s + "0")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=0;
else:
  ans=1;
printf('%d %d'%(inp[0]*inp[1]*0.5,ans))

Submission status: Runtime Error

Solution code:
str = input()
W = int(str.split()[0])
H = int(str.split()[1])
x = int(str.split()[2])
y = int(str.split()[3])
a = 0
b = 0
t = []
c = 0
d = 0
e = 0
if ((W == x and H == y) or (x == 0 and y == 0)) :
		a = W * H / 2
		b = 0
else :
	Z = W * H
	if (x != 0 and x != W) :
		if (x * H < Z - x * H) :
			t.append(x * H)
		else :
			t.append(Z - x * H)
	if (x != 0 and y != 0) :
		if (H * x / y < W) :
			st = H * x / y * H / 2
		else :
			st = W * y / x * W / 2
		if (st < Z - st) :
			t.append(st)
			c = st
		else :
			t.append(Z - st)
			c = Z - st
	if (x != 0 and y != H) :
		xt = -1 *  x * H / (y - H)
		if (xt > W) :
			st = W * ((y - H) / x * W + H) / 2
		else :
			st = xt * H / 2
		if (st < Z - st) :
			t.append(st)
			d = st
		else :
			t.append(Z - st)
			d = Z - st
	if (y != 0 and y != H) :
		if (W * y < Z - W * y) :
			t.append(W * y)
		else :
			t.append(Z - W * y)
	if (y != 0 and x != W) :
		xt = (y / (W - x) * W - H) * (W - x) / y
		if (xt >= 0) :
			st = (W - xt) * H / 2
		else :
			st = W * y / (W - x) * W / 2
		if (st < Z - st) :
			t.append(st)
			if (d == st) :
				e = 1
		else :
			t.append(Z - st)
			if (d == st) :
				e = 1
	if (x != W and y != H) :
		yt = H -  (H - y) / (W - x) * W
		if (yt >= 0) :
			st = W * (H - yt) / 2
		else :
			st = (W - ((H - y) / (W - x) * W - H) * (W - x) / (H - y)) * H / 2
		if (st < Z - st) :
			t.append(st)
			if (c == st) :
				e = 1
		else :
			t.append(Z - st) :
			if (c == st) :
				e = 1
	a = 0
	b = 0
	for i in t:
		if (a < i) :
			a = i
			b = 0
		elif (a == i) :
			if (e == 0) :
				b = 1

print("{} {}".format(a, b))

Submission status: Runtime Error

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

if (x == 0 or x == W) or (y == 0 and y == H) or x * H == W * y or x * H + W * y = W * H:
    print(W*H/2, 0)
else:
    S = W*min(y,H-y)
    T = min(x,W-x)*H
    counter = 0
    if S == T:
        counter += 1
    print(max(S,T), counter)

Submission status: Runtime Error

Solution code:
a, b, x, y = map(int, input().split())
ans = double(a)*double(b) / 2.0
if(x + x == a and y + y == b):
    num = 1
else:
    num = 0

print(ans, num)

Submission status: Runtime Error

Solution code:
W,H,x,y=map(int,input().split())
print(max(min(x*H,(W-x)*H),min(y*W,(H-y)*W)),sum([x/W==y/H,x/W==(H-y)/H,(W-x)/W==y/H])=>1)

Submission status: Runtime Error

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  (H % 2 == 0)  and (W/2 == x) 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(H)/2.0 * W , ans2)
        return

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:


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

j = (bigarea/2.000000)

# print('{:6f}'.format(bigarea/2))

if j % 2 ==0:
    k = '1'
elif W /2 == x and H / 2 == y:
    k = '0'

if x == 0 and y == 0:
    j = 0

# print(j, k)
# j = str(j)
print('{:6f} {:}'.format(j,k))

Submission status: Runtime Error

Solution code:
class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y    

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

square_area = w * h

px = w / 2  # 3
py = h / 2  # 3.5

multiple_ans = 0
if px == x and py == y:
    multiple_ans = 1

a = py - y / px - x
b = y - x * a

cross_point = []

cross_x = (h - b) / a  # 一番上
if not 0 <= cross_x <= w:
    cross_point.append(Point(cross_x, h))
cross_x = (b / a) * -1  # 一番下
if not 0 <= cross_x <= w:
    cross_point.append(Point(cross_x, 0))
cross_y = b
if not 0 <= cross_y <= h:
    cross_point.append(Point(0, cross_y))
cross_y = w * a + b
if not 0 <= cross_y <= h:
    cross_point.append(Point(w, cross_y))

cross_1 = cross_point[0]
cross_2 = cross_point[1]

if cross_1.y == 0 and cross_2.x == w:
    area_a = ((h - cross_2.y) * cross_1.x) / 2
    area_b = square_area - area_a
elif cross_2.x == w and cross_1.y == 0:
    area_a = ((w - cross_2.x) * cross_1.y) / 2
    area_b = square_area - area_a
elif cross_2.x == w and cross_1.y == h:
    area_a = (w - cross_1.x) * (h - cross_2.y) / 2
    area_b = square_area - area_a
elif cross_2.x == w and cross_1.y == 0:
    area_a = (cross_1.x * cross_2.x) / 2
    area_b = square_area - area_a
else:
    area_a = (cross_1.y * cross_2.y) / 2
    area_b = square_area - area_a

print('{max_area} {multiple_ans}'.format(max_area=str(min(area_a, area_b)), multiple_ans=str(multiple_ans)))

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())
bigarea = W * H

j = (bigarea/2.000000)

# print('{:6f}'.format(bigarea/2))

if j % 2 ==0:
    k = '1'
elif W /2 == x and H / 3 == y:
    k = '0'

if x == 0 and y == 0:
    j = 0

# print(j, k)
# j = str(j)
print('{:6f} {:}'.format(j,k))

Submission status: Runtime Error

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

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

if x == W / 2 :
  if y == H / 2 :
    ans = 1
  else : 
    ans = 0
else :
  ans = 0
  
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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


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

else:
    print (W*H/2,0)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans.append('{:.7f}'.format(w*h/2))

if w % x == 0 and h % y == 0:
    ans.append(1)
else:
    ans.append(0)

print(*ans, sep=' ')

Submission status: Runtime Error

Solution code:
W, H, x, y = map(int,input().split())
ans = [min(x*H, (W-x)*H), min(W*y, W*(H-y))]
f = 0
if x== 0 or y == 0 or W == x or H == y :
    ans.append(0.5*W*H)
    f = 1
else :
    ans.append(0.5*W*H)
if min(ans[0], ans[1]) == min(ans[2], ans[3]) and f == 0 :
    print(min(ans), 1)
else :
    print(min(ans), 0)

Submission status: Runtime Error

Solution code:
w,h,x,y=map(int,input().split())
area=w*h
if x!=0:
    if (y/x)*w>=h:
        ax=(h/y)*x
        if ((y-h)/x)*w+h>=0:
            ayy=((y-h)/x)*w+h
            axx=((x-w)*w)/y+w
            if y!=h:
                ay=((y-h)/(w-x))*w+h
                lst=[min(area-((w-axx)*h)/2,((w-axx)*h)/2),min(area-((h-ayy)*w)/2,((h-ayy)*w)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ax*h)/2,(ax*h)/2),min(area-(ay*w)/2,(ay*w)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
            else:
                lst=[min(area-((w-axx)*h)/2,((w-axx)*h)/2),min(area-h*x,h*x),min(area-(ax*h)/2,(ax*h)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
        else:
            axx=(h*x)/(h-y)
            ayy=(w*y)/(w-y)
            ay=((y-h)/(w-x))*w+h
            lst=[min(area-(w*ayy)/2,(w*ayy)/2),min(area-(axx*h)/2,(axx*h)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ax*h)/2,(ax*h)/2),min(area-(ay*w)/2,(ay*w)/2)]
            ans=max(lst)
            if lst.count(ans)==1:
                f=0
            else:
                f=1
    else:
        ay=(w*y)/x
        if ((y-h)/x)*w+h>=0:
            axx=((x-w)*w)/y+w
            ayy=((y-h)/x)*w+h
            if x!=w:
                ax=((w-x)/(y-h))*h+w
                lst=[min(area-((w-axx)*h)/2,((w-axx)*h)/2),min(area-((h-ayy)*w)/2,((h-ayy)*w)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2),min(area-((w-ax)*h)/2,((w-ax)*h)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
            else:
                lst=[min(area-((h-ayy)*w)/2,((h-ayy)*w)/2),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
        else:
            axx=(h*x)/(h-y)
            ayy=(w*y)/(w-y)
            ax=((w-x)/(y-h))*h+w
            lst=[min(area-(w*ayy)/2,(w*ayy)/2),min(area-(axx*h)/2),min(area-(axx*h)/2,(axx*h)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2),min(area-((w-ax)*h)/2,((w-ax)*h)/2)]
            ans=max(lst)
            if lst.count(ans)==1:
                f=0
            else:
                f=1
else:
    lst=[min(area-w*y,w*y),min(((h-y)*w)/2,area-((h-y)*w)/2),min(area-(y*w)/2,(y*w)/2)]
    ans=max(lst)
    if lst.count(ans)==1:
        f=0
    else:
        f=1
print(ans,f)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- Coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int,input().split()))

index = 0
Sum = 0
while Sum <= X:
    Sum += L[index]
    index += 1

print(index+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

A = W*H

B = max(W-x,x)*max(H-y,y)

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

elif x == 0 or x == W:
  print(min(H-y,y)*W,end=' ')
  print(0)
  
elif y == 0 or y == H:
  print(min(W-x,x)*H,end=' ')
  print(0)
  
elif W%x == 0 and H%y == 0:
  print(A//2,end=' ')
  print(1)
  
elif W%x == 0 or H%y == 0:
  print(A//2,end=' ')
  print(0)
  
else:
  max(y/x*W/2,min(W-x,x)*H,min(H-y,y)*W,end=' ')
  print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

A = input()

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

S1 = x * H
S2 = (W-x) * H
if (S1>S2):
  S3 = S2
else:
  S3 = S1

S4 = (H-y) * W
S5 = y * W

if (S4>S5):
  S6 = S5
else:
  S6 = S4

if(S3>S6):
  Ans = S3
  pat = 0
elif(S3==s6):
  Ans = S3
  pat = 1
else:
  Ans = S6
  pat = 0

print("{} {}".format(Ans,pat))

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):
	print(0, 0)
	exit()

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

s1 = float(min(x*H, W*H-x*H))
s2 = float(min(y*W, W*H-y*W))
s3 = float(min((y/x*W * W * 0.5), H/((-1*(H-y)/x) + H) * H * 0.5))

b = 0
if s1 != s2 and s2 != s3 and s1 != s3:
	b = 0
else:
	b = 1
    
print(max(s1, s2, s3), b)

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 x == 0 and y == 0:
    print(w * h / 2,end=" ")
    print(0)
elif x == 0:
    print(max(((h - y) * w) / 2,(y * w) / 2),end=" ")
    print(0)
elif y == 0:
    print(max(((w - x) * h) / 2,(x * h) / 2),end=" ")
    print(0)
elif w / x == h / y:
    print(w * h / 2,end=" ")
    print(0)
elif w / 2 == x:
    print(x * h,end=" ")
    print(0)
elif h / 2 == y:
    print(w * y,end=" ")
    print(0)
else:
    print(max(w * y,x * h,((w-x)*(h-y))/2,end=" "))
    print(0)

Submission status: Runtime Error

Solution code:
W, H, x, y = map(int, input().split())
full = W*H
count = 0
if x == (W/2):
    if y == (H/2):
        men = W*H/2
        print(men)
        print(1)
    else:
        men = W*H/2
        print(men)
        print(0)
elif y==(H/2):
    men = W*H/2
    print(men)
    print(0)

else:
    X1 = x*H
    X2 = (W-x)*H
    X = [X1, X2]
    XX = max(X)
    Y1 = W*y
    Y2 = W*(H-y)
    Y = [Y1, Y2]
    YY = max(Y)
    if XX == YY:
        print(menseki)
        print(1)
    else:
        menseki = min(XX, YY)
        print(menseki)
        print(0)

Submission status: Runtime Error

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


if x == 0 and y == 0:
    s1 = h * w / 2
    s1 = s2
else:
    ym = min(y, h - y)
    xm = min(x, w - x)

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

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

Submission status: Runtime Error

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

if w == 0 or y == 0:
	print(0,"0")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

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):
	print(0, 0)
	exit()

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


s1 = float(min(x*H, W*H-x*H))
s2 = float(min(y*W, W*H-y*W))
s3 = float(min((y/x*W * W * 0.5), H/((-1*(H-y)/x) + H) * H * 0.5))

b = 0
if s1 != s2 and s2 != s3 and s1 != s3:
	b = 0
else:
	b = 1
    
print(max(s1, s2, s3), b)

Submission status: Runtime Error

Solution code:
w,h,x,y = map(int, input().split())
max = float((w * h) / 2)
if not (x*2=w and y*2=h)  and  ((w * y) == (x * h) or w * y == h * (w - x) or (x*2=w and (y=0 or y=h) or y*2=h and (x=0 or x=w)) 
  print(str(max) + ' 1')
else:
  print(str(max) + ' 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 x == 0 and y == 0:
    print(w * h / 2,end=" ")
    print(0)
elif x == 0:
    print(max(((h - y) * w) / 2,(y * w) / 2),end=" ")
    print(0)
elif y == 0:
    print(max(((w - x) * h) / 2,(x * h) / 2),end=" ")
    print(0)
elif w / x == h / y:
    print(w * h / 2,end=" ")
    print(0)
elif w / 2 == x:
    print(x * h,end=" ")
    print(0)
elif h / 2 == y:
    print(w * y,end=" ")
    print(0)
else:
    print(max(w * y,x * h,((w-x)*(h-y))/2,end=" ")
    print(0)

Submission status: Runtime Error

Solution code:
w, h, x, y = map(int, input().split())
count = 0
area_a = 0
area_b = 0
output = 0

if (x == 0 and y == 0) or (x == w and y == 0) or (x == w and y == h) or (x == 0 and y == h):
    output = w*h/2

elif x == 0 or x == w:
    output = (y+(h-y)) * w/2
elif y == 0 or y == h:
    output = (x+(w-x)) * h/2

else:
    center_x, center_y = w/2, h/2
    i = center_x - x
    j = center_y - y
    w0_h = i*0 + j
    w1_h = i*x + j
    if (w0_h <= h and w0_h >= 0) and (w1_h <= h and w1_h >= 0):
        output = (w0_h+(h-w1_h)) * w/2
    h0_w = -(j/i)
    h1_w = (h-j)/i
    if (h0_w <= w and h0_w >= 0) and (h1_w <= w and h1_w >= 0):
        output = (h0_w+(w-h1_w)) * h/2

print(str(output) + " " + str(count))

Submission status: Runtime Error

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/y) == (H/x):
    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: Runtime Error

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

if w == 0 and y == 0:
	print(0,"1")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

Submission status: Runtime Error

Solution code:
W,H,x,y = map(int,input().split())
if x == W/2 and y != H/2:
  print(x*H,0)
elif x!= W/2 and y == W/2:
  print(y*W,0)
elif x == W/2 and y == H/2:
  print(x*H,1)
elif (x == 0 and 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)
elif x < W/2 and y < H/2 and Wy-xH>=0:
  print(W**2*(H-y)/(W-x)*2,0)
elif x < W/2 and y < H/2 and Wy-xH<0:
  print(H**2*(W-x)/(H-y)*2,0)
elif x < W/2 and y > H/2 and W*(H-y)-xH>=0:
  print(W**2*y/(W-x)*2,0)
elif x < W/2 and y > H/2 and W*(H-y)-xH<0:
  print(H**2*(W-x)/y*2,0)
elif x > W/2 and y < H/2 and Wy-(W-x)*H>=0:
  print(W**2*(H-y)/x*2,0)
elif x > W/2 and y < H/2 and Wy-(W-x)*H<0:
  print(H**2*x/(H-y)*2,0)
elif x > W/2 and y > H/2 and xH-Wy>=0:
  print(W**2*y/x*2,0)
elif x > W/2 and y > H/2 and xH-Wy<0:
  print(H**2*x/y*2,0)

Submission status: Runtime Error

Solution code:
# 結局平行線か45度かのminな気がする 真ん中は(H+W-2)
# 頂点にある場合もある
w, h, x, y = map(int, input().split())
ans = 0
if 0 == x or x == w and 0 == y or y == h:
    ans = min(w / 2, h / 2)
    print(ans, endl=" ")
    print(1 if w == h else 0)
    exit()
if 0 == x or x == w:
    # y軸で切る or 0かwの近い方への差
    if y < h // 2:
        ans = min(y * w, y / 2)
    else:
        ans = min((h - y) * y, (h - y) / 2)
elif 0 == y or y == h:
    # x軸で切る
    if x < w // 2:
        ans = min(x * h, x / 2)
    else:
        ans = min((w - x) * x, (w - x) / 2)

if ans != 0:
    print(ans, 0)
else:
    if x == w/2 or y == h/2:
        if w == y:
            # 真ん中
            print(x * y, 1)
        else:
            print(min(x * y, (w - x) * y, (h - y) * x), 1)
    else:
        print(min([y * w, y / 2, (h - y) * y, (h - y) / 2,
                   x * h, x / 2, (w - x) * x, (w - x) / 2]), 0)

Submission status: Runtime Error

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

if w == 0 and y == 0:
	print(0,"0")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

Submission status: Runtime Error

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

min_1 = min((w - x) * h, x * h)
min_2 = min((h - y) * w, y * w)
min_3 = 0
if abs(w / x) == abs(h / y):
    min_3 = w * h / 2

if abs(w / x) == abs(h / y):
    print('{:.6f} {}'.format(min_3, 1))
elif min_1 == min_2:
    print('{:.6f} {}'.format(min_1, 1))
else:
    print('{:.6f} {}'.format(max(min_1, min_2), 0))

Submission status: Runtime Error

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

if w == h and w % 2 == 0:
    if x == w or y == h:
        f = w
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
    else:  
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
elif w == h and w % 2 != 0:
    f = w*h*2/3
    print('{:.6f}'.format(f),end = "")
    print(" " + str(1))
else:
    f = max(w,h)
    if w % 2 != 0 and h % != 0:
        if x == 1 and y == 1:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        elif  x == w and y == h:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        elif x == 1 and y == h:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        elif x == w and y == 1:
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
        else:
            f = w*h*2/3
            print('{:.6f}'.format(f),end = "")
            print(" " + str(0))
            
        
    if f/2 -1 == x or f/2 - 1 == y or f/2 == x or f/2  == y:
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(1))
    elif x == 1 and y == 1:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif  x == w and y == h:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif x == 1 and y == h:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    elif x == w and y == 1:
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))
    else:
        f = w*h/2
        print('{:.6f}'.format(f),end = "")
        print(" " + str(0))