結果
| 問題 | No.2923 Mayor's Job | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-10-14 12:05:27 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 134 ms / 2,000 ms | 
| コード長 | 1,238 bytes | 
| コンパイル時間 | 2,202 ms | 
| コンパイル使用メモリ | 157,540 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-14 12:05:34 | 
| 合計ジャッジ時間 | 3,915 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#ifdef local
#include <C++/core/io/debug_print.hpp>
#else
#define dump(...) void(0);
#endif
#include <iostream>
#include <ranges>
#include <valarray>
#include <vector>
#include <cmath>
#include <unordered_set>
namespace man {
constexpr inline long double dist(const std::pair<int, int> &p, const std::pair<int, int> &q) noexcept {
    return std::hypotl(p.first - q.first, p.second - q.second);
}
}
int main() {
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    using namespace std::views;
    int n, k;
    std::cin >> n >> k;
    std::valarray<int> h(n);
    for(auto &e: h) {
        std::cin >> e;
    }
    std::vector<std::pair<int, int>> pos(n);
    for(auto &[x, y]: pos) {
        std::cin >> x >> y;
    }
    std::unordered_set<int> del;
    for(const auto i: iota(0, n)) {
        for(const auto j: iota(i + 1, n)) {
            if(man::dist(pos[i], pos[j]) <= k) {
                if(h[i] == h[j]) {
                    continue;
                }
                del.emplace(h[i] < h[j] ? i : j);
            }
        }
    }
    std::cout << n - del.size() << '\n';
}
            
            
            
        