/* -*- coding: utf-8 -*- * * 2923.cc: No.2923 Mayor's Job - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 2000; /* typedef */ using ll = long long; using pii = pair; /* global variables */ int hs[MAX_N], xs[MAX_N], ys[MAX_N]; pii his[MAX_N]; /* subroutines */ ll dist2(int u, int v) { int dx = xs[v] - xs[u], dy = ys[v] - ys[u]; return (ll)dx * dx + (ll)dy * dy; } /* main */ int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", hs + i); for (int i = 0; i < n; i++) scanf("%d%d", xs + i, ys + i); for (int i = 0; i < n; i++) his[i] = {hs[i], i}; sort(his, his + n); ll kk = (ll)k * k; int cnt = 0; for (int i = 0; i < n; i++) { auto [hu, u] = his[i]; for (int j = i + 1; j < n; j++) { auto [hv, v] = his[j]; if (hu < hv && dist2(u, v) <= kk) { cnt++; break; } } } printf("%d\n", n - cnt); return 0; }