結果

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

ソースコード

diff #

#![allow(dead_code, unused_imports, unused_macros, non_snake_case)]

fn main() {
    input! {
        N: usize, K: i64,
        H: [i64; N],
        pos: [(i64, i64); N],
    }

    let mut ans = N;
    let mut order = (0 .. N).collect::<Vec<_>>();
    order.sort_by_key(|&i| H[i] );

    for i in order {
        for j in 0 .. N {
            let (x1, y1) = pos[i];
            let (x2, y2) = pos[j];
            let dx = x1 - x2;
            let dy = y1 - y2;
            if H[i] < H[j] && dx * dx + dy * dy <= K * K {
                ans -= 1;
                break;
            }
        }
    }

    println!("{ans}");
}

type Int = i64;
const MOD: Int = 1_000_000_007;
const INF: Int = 1_000_000_000;
const YESNO: [&'static str; 2] = ["Yes", "No"];

use proconio::{input, marker::{Usize1, Chars}};

fn yes() { println!("{}", YESNO[0]); }
fn no() { println!("{}", YESNO[1]); }
fn yesno(c: bool) { println!("{}", if c { YESNO[0] } else { YESNO[1] }); }
0