use proconio::input; use proconio::fastout; fn pow(x: isize) -> isize { return x * x; } #[fastout] #[allow(non_snake_case)] fn main() { input! { (N, K): (usize, isize), H: [usize; N], } assert!(1 <= N && N <= 2_000); assert!(1 <= K && K <= 1_000_000_000); assert!(H.iter().all(|&x| 1 <= x && x <= 1_000_000_000)); let mut X = Vec::new(); let mut Y = Vec::new(); for _ in 0..N { input! { (x, y): (isize, isize), } assert!(1 <= x && x <= 1_000_000_000); assert!(1 <= y && y <= 1_000_000_000); X.push(x); Y.push(y); } let mut ans = N; for i in 0..N { for j in 0..N { if i == j { continue; } if H[i] < H[j] && pow(X[i] - X[j]) + pow(Y[i] - Y[j]) <= pow(K) { ans -= 1; break; } } } println!("{}", ans); }