結果
問題 |
No.2923 Mayor's Job
|
ユーザー |
![]() |
提出日時 | 2024-10-12 14:56:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 585 bytes |
コンパイル時間 | 2,204 ms |
コンパイル使用メモリ | 204,276 KB |
最終ジャッジ日時 | 2025-02-24 17:47:34 |
ジャッジサーバーID (参考情報) |
judge1 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/dsu> using namespace std; int main(){ int n;long long k;cin>>n>>k; vector<long long> h(n),x(n),y(n); for(int i=0;i<n;i++)cin>>h[i]; for(int i=0;i<n;i++)cin>>x[i]>>y[i]; vector<pair<long long,int>> srt(n); for(int i=0;i<n;i++)srt[i]={h[i],i}; sort(srt.begin(),srt.end()); int ct=0; for(auto [_,i]:srt){ bool ok=false; for(int j=0;j<n;j++){ if((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<=k*k&&h[j]>h[i])ok=true; } if(!ok)ct++; } cout<<ct<<"\n"; }