結果
| 問題 | No.2923 Mayor's Job | 
| コンテスト | |
| ユーザー |  Tatsu_mr | 
| 提出日時 | 2024-10-12 16:03:28 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 67 ms / 2,000 ms | 
| コード長 | 1,351 bytes | 
| コンパイル時間 | 3,149 ms | 
| コンパイル使用メモリ | 251,164 KB | 
| 実行使用メモリ | 58,112 KB | 
| 最終ジャッジ日時 | 2024-10-12 16:03:51 | 
| 合計ジャッジ時間 | 4,272 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define rALL(v) (v).rbegin(), (v).rend()
using namespace std;
using lint = long long;
using ld = long double;
template <class T>
struct Edge {
    int from, to;
    T cost;
    int idx;
    
    Edge() {}
    Edge(int to_) : to(to_) {}
    Edge(int to_, T cost_) : to(to_), cost(cost_) {}
    Edge(int from_, int to_, int idx_) : from(from_), to(to_), idx(idx_) {}
    Edge(int from_, int to_, T cost_, int idx_) : from(from_), to(to_), cost(cost_), idx(idx_) {}
};
template <class T> using Graph = vector<vector<Edge<T>>>;
using graph = Graph<long long>;
using edge = Edge<long long>;
#define add emplace_back
int main() {
    int n;
    lint k;
    cin >> n >> k;
    vector<lint> h(n), x(n), y(n);
    rep(i, n) {
        cin >> h[i];
    }
    rep(i, n) {
        cin >> x[i] >> y[i];
    }
    graph g(n);
    rep(i, n) {
        rep(j, n) {
            if (i == j) {
                continue;
            }
            lint d = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
            if (h[i] < h[j] && d <= k * k) {
                g[i].add(j);
            }
        }
    }
    int ans = 0;
    rep(v, n) {
        if ((int)g[v].size() == 0) {
            ans++;
        }
    }
    cout << ans << endl;
}
            
            
            
        