use proconio::input; const DIFFS: [(f64, f64); 4] = [(1.0, 0.0), (-1.0, 0.0), (0.0, 1.0), (0.0, -1.0)]; fn main() { input! { triangle: [(f64, f64); 3], } let mut ans = 0.0; let mut stack: Vec> = vec![vec![]]; while let Some(apexes) = stack.pop() { if apexes.len() == 3 { let area = calc_area(&apexes); if area > ans { ans = area; } continue; } let apex_idx = apexes.len(); for (dx, dy) in DIFFS { let mut apexes = apexes.clone(); let (x, y) = triangle[apex_idx]; apexes.push((x + dx, y + dy)); stack.push(apexes); } } println!("{}", ans); } fn calc_area(triangle: &[(f64, f64)]) -> f64 { let (x0, y0) = triangle[0]; let (x1, y1) = triangle[1]; let (x2, y2) = triangle[2]; let (dx1, dy1) = (x1 - x0, y1 - y0); let (dx2, dy2) = (x2 - x0, y2 - y0); (dx1 * dy2 - dx2 * dy1).abs() / 2.0 }