結果
問題 |
No.2923 Mayor's Job
|
ユーザー |
![]() |
提出日時 | 2024-09-28 17:16:02 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 945 bytes |
コンパイル時間 | 12,991 ms |
コンパイル使用メモリ | 377,512 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 08:49:13 |
合計ジャッジ時間 | 14,270 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
use proconio::input; use proconio::fastout; fn pow(x: isize) -> isize { return x * x; } #[fastout] #[allow(non_snake_case)] fn main() { input! { (N, K): (usize, isize), H: [usize; N], } assert!(1 <= N && N <= 2_000); assert!(1 <= K && K <= 1_000_000_000); assert!(H.iter().all(|&x| 1 <= x && x <= 1_000_000_000)); let mut X = Vec::new(); let mut Y = Vec::new(); for _ in 0..N { input! { (x, y): (isize, isize), } assert!(1 <= x && x <= 1_000_000_000); assert!(1 <= y && y <= 1_000_000_000); X.push(x); Y.push(y); } let mut ans = N; for i in 0..N { for j in 0..N { if i == j { continue; } if H[i] < H[j] && pow(X[i] - X[j]) + pow(Y[i] - Y[j]) <= pow(K) { ans -= 1; break; } } } println!("{}", ans); }