// 点列を2つに切る // 左->右の傾きの最大値を最小化 // abc341? // // 1:N or N:1 が最善か use proconio::input; fn main() { input! { n: usize, a: [i64; n], b: [i64; n], } let mut y = vec![0; n + 1]; let mut x = vec![0; n + 1]; for i in 0..n { y[i + 1] = y[i] + a[i]; x[i + 1] = x[i] + b[i]; } // eprintln!("y: {y:?}"); // eprintln!("x: {x:?}"); let mut cand1 = (1, 0); { for i in 1..=n { let dx = x[i] - x[0]; let dy = y[i] - y[0]; if dx * cand1.1 < dy * cand1.0 { cand1 = (dx, dy); } } } let mut cand2 = (1, 0); { for i in 0..n { let dx = x[n] - x[i]; let dy = y[n] - y[i]; if dx * cand2.1 < dy * cand2.0 { cand2 = (dx, dy); } } } let ans = if cand1.1 * cand2.0 < cand2.1 * cand1.0 { cand1 } else { cand2 }; let ans = ans.1 as f64 / ans.0 as f64; println!("{ans:.10}"); }