use proconio::{input, fastout}; use std::collections::HashMap; #[fastout] fn main() { input! { n: usize, h: usize, a: [usize; n] } let mut map = HashMap::new(); let mut i = 2; let mut m = h; while i * i <= m { while m % i == 0 { m /= i; if map.contains_key(&i) { let x = map.get_mut(&i).unwrap(); *x += 1; } else { map.insert(i, 1); } } i += 1; } if m > 1 { if map.contains_key(&m) { let x = map.get_mut(&m).unwrap(); *x += 1; } else { map.insert(m, 1); } } for i in 0..n { if h == a[i] { println!("YES"); return; } if map.contains_key(&a[i]) { let x = map.get_mut(&a[i]).unwrap(); *x -= 1; } } for (_, v) in &map { if 0 < *v { println!("NO"); return; } } println!("YES"); }