struct Solution; impl Solution { pub fn maximum_tastiness(mut price: Vec, k: i32) -> i32 { price.sort_unstable(); let mut l = 0; let mut r = price.last().unwrap() - price.first().unwrap(); while l < r { let mid = l + r + 1 >> 1; let mut fm = -mid; let mut cnt = 0; for &x in price.iter() { if x - fm >= mid { cnt += 1; fm = x; } } if cnt < k { r = mid - 1; } else { l = mid; } } l } } fn main() { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).ok(); let price: Vec = buf.trim().split(' ').map(|x|x.parse::().unwrap()).collect::>(); buf.clear(); std::io::stdin().read_line(&mut buf).ok(); let k: i32 = buf.trim().parse::().unwrap(); println!("{}", Solution::maximum_tastiness(price, k)); }