結果
問題 | No.2923 Mayor's Job |
ユーザー |
|
提出日時 | 2024-10-26 04:52:21 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 176 ms / 2,000 ms |
コード長 | 596 bytes |
コンパイル時間 | 254 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 44,928 KB |
最終ジャッジ日時 | 2024-10-26 04:52:26 |
合計ジャッジ時間 | 4,026 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
const pi=r=>r.split(" ").map(_=>parseInt(_)); function Main(INPUT){ const input = INPUT.split("\n"); const [N,K]=pi(input[0]); let H=pi(input[1]); let plot=[]; for(let i=0;i<N;i++){ plot.push(pi(input[i+2])); } const dist=((s,t)=>Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))); let cnt=N; for(let i=0;i<N;i++){ let survive=true; for(let j=0;j<N;j++){ if(i!=j && H[i]<H[j] && dist(plot[i],plot[j])<=K){ survive=false; } } if(!survive) cnt--; } console.log(cnt); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));