結果
問題 | No.2923 Mayor's Job |
ユーザー |
|
提出日時 | 2024-10-28 23:47:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 886 bytes |
コンパイル時間 | 2,462 ms |
コンパイル使用メモリ | 200,568 KB |
最終ジャッジ日時 | 2025-02-25 01:12:48 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() ll sqdist(ll x1, ll y1, ll x2, ll y2) { return (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2); } int main() { cin.tie(nullptr); ll N, K; cin >> N >> K; vector<pair<ll, int>> H(N); vector<ll> X(N), Y(N); rep(i, 0, N) { cin >> H[i].first; H[i].second = i; } rep(i, 0 , N) cin >> X[i] >> Y[i]; sort(all(H)); int ans = N; rep(ii, 0, N - 1) rep(jj, ii + 1, N) { if (H[ii].first < H[jj].first) { int i = H[ii].second; int j = H[jj].second; if (sqdist(X[i], Y[i], X[j], Y[j]) <= K * K) { ans--; break; } } } cout << ans << '\n'; }