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

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

#[derive(Debug)]
struct Square {
  w: f64,
  h: f64,
}

impl Square {
  fn minus_height(&self, square: &Self) -> Self {
    Square {
      w: self.w,
      h: self.h - square.h,
    }
  }

  fn minus_width(&self, square: &Self) -> Self {
    Square {
      w: self.w - square.w,
      h: self.h,
    }
  }

  // 縦割り
  pub fn vertical_split(&self, x: f64) -> (Self, Self) {
    let left_side = Square { w: x, h: self.h };
    let right_side = self.minus_width(&left_side);
    (left_side, right_side)
  }

  // 横割り
  pub fn horizontal_split(&self, y: f64) -> (Self, Self) {
    let upper_side = Square { w: self.w, h: y };
    let bottom_side = self.minus_height(&upper_side);
    (upper_side, bottom_side)
  }

  // 面積計算
  fn area(&self) -> f64 {
    self.w * self.h
  }
}

fn min(a: f64, b: f64) -> f64 {
  if a < b {
    a
  } else {
    b
  }
}

fn max(a: f64, b: f64) -> f64 {
  if a < b {
    b
  } else {
    a
  }
}

fn main() {
  let w = read::<f64>();
  let h = read::<f64>();
  let x = read::<f64>();
  let y = read::<f64>();

  let square = Square { w: w, h: h };
  let (left, right) = square.vertical_split(x);
  let max_size_1 = max(left.area(), right.area());

  let (upper, bottom) = square.horizontal_split(y);
  let max_size_2 = max(upper.area(), bottom.area());

  print!("{:.6} ", min(max_size_1, max_size_2));

  match x * 2 as f64 == w && y * 2 as f64 == h {
    true => print!("1\n"),
    false => print!("0\n"),
  }
}