結果
| 問題 |
No.2923 Mayor's Job
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-17 18:09:03 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 1,575 bytes |
| コンパイル時間 | 5,858 ms |
| コンパイル使用メモリ | 290,384 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 18:09:10 |
| 合計ジャッジ時間 | 4,501 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/fenwicktree>
using namespace atcoder;
// using mint = modint998244353;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const ll LINF = 3001001001001001001;
const int MOD = 998244353;
const string Yes = "Yes";
const string No = "No";
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> istream &operator>>(istream &is, vector<T> &v) {for (T &in : v)is >> in;return is;}
// #include <ext/pb_ds/assoc_container.hpp>
// template<typename T>
// using ordered_set = __gnu_pbds::tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main() {
ll n,k;cin>>n>>k;
vector<tuple<ll,ll,ll>> hxy(n);
rep(i,n) {
ll h;cin>>h;
hxy.at(i) = tuple(h,0,0);
}
rep(i,n) {
ll x,y;cin>>x>>y;
hxy.at(i) = tuple(get<0>(hxy.at(i)),x,y);
}
sort(all(hxy));
vector<ll> h(n),x(n),y(n);
rep(i,n) {
auto [a,b,c] = hxy.at(i);
h.at(i) = a;
x.at(i) = b;
y.at(i) = c;
}
ll ans = n;
rep(i,n) {
reps(j,i+1,n) {
if(h.at(i)>=h.at(j)) continue;
ll dx = abs(x.at(i)-x.at(j));
ll dy = abs(y.at(i)-y.at(j));
ll d = dx*dx+dy*dy;
if(k*k>=d) {
ans--;break;
}
}
}
cout << ans << endl;
return 0;
}