fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn main() { let _: usize = read(); let ws: Vec = read_vec(); let w_sum: usize = ws.iter().sum(); if w_sum % 2 == 1 { println!("impossible"); return; } let mut dp = vec![false; w_sum / 2 + 1]; dp[0] = true; for i in 0..ws.len() { for j in (0..w_sum / 2 + 1).rev() { if j >= ws[i] && dp[j - ws[i]] { dp[j] = true; } } } if dp[w_sum / 2] { println!("possible"); } else { println!("impossible"); } }