結果
| 問題 | No.2923 Mayor's Job | 
| コンテスト | |
| ユーザー |  はるお味 | 
| 提出日時 | 2024-10-14 09:03:15 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 11 ms / 2,000 ms | 
| コード長 | 817 bytes | 
| コンパイル時間 | 3,281 ms | 
| コンパイル使用メモリ | 258,144 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-14 09:03:19 | 
| 合計ジャッジ時間 | 4,279 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<VL> VVL;
typedef long long LL;
#define all(a) (a).begin(), (a).end()
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
int n,kk; LL k;
LL dd(LL a,LL b){
  //cout<<k<<' '<<a*a+b*b<<endl;
  return a*a+b*b;
}
int main() {
  cin>>n>>kk;
  k=LL(kk)*kk;
  VVI H(n,VI(3));
  rep(i,n){
    cin>>H[i][0];
  }
  rep(i,n){
    cin>>H[i][1]>>H[i][2];
  }
  
  sort(all(H));
  bool K[n]={};
  int ans=n;
  rep(i,n){
    rep(j,i){
      if(K[j]==1||H[j][0]==H[i][0]){continue;}
      if(dd(H[i][1]-H[j][1],H[i][2]-H[j][2])<=k){K[j]=1;ans--;}
    }
  }
  cout<<ans<<endl;
}
            
            
            
        