結果

問題 No.2923 Mayor's Job
ユーザー tnodino
提出日時 2024-06-16 09:48:57
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 749 bytes
コンパイル時間 13,058 ms
コンパイル使用メモリ 378,448 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 21:16:33
合計ジャッジ時間 14,245 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;
use proconio::fastout;

fn pow(x: isize, k: usize) -> isize {
    let mut ret = 1;
    for _ in 0..k {
        ret *= x;
    }
    return ret;
}

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        (N, K): (usize, isize),
        H: [usize; N],
    }
    let mut vec = Vec::new();
    for _ in 0..N {
        input! {
            (X, Y): (isize, isize),
        }
        vec.push((X, Y));
    }
    let mut flg = vec![true; N];
    for i in 0..N {
        for j in 0..N {
            if H[i] < H[j] && pow((vec[i].0 - vec[j].0).abs(), 2) + pow((vec[i].1 - vec[j].1).abs(), 2) <= pow(K, 2) {
                flg[i] = false;
            }
        }
    }
    println!("{}", flg.iter().filter(|&&x| x).count());
}
0