結果
| 問題 |
No.2923 Mayor's Job
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 15:32:19 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 1,518 bytes |
| コンパイル時間 | 14,946 ms |
| コンパイル使用メモリ | 401,400 KB |
| 実行使用メモリ | 23,424 KB |
| 最終ジャッジ日時 | 2024-10-12 15:32:53 |
| 合計ジャッジ時間 | 13,970 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::nonminimal_bool)]
#![allow(clippy::neg_multiply)]
#![allow(dead_code)]
#![allow(clippy::collapsible_else_if)]
use proconio::{
fastout, input, input_interactive,
marker::{Chars, Usize1},
};
use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::mem::swap;
//const MOD: usize = 1e9 as usize + 7;
const MOD: usize = 998244353;
// const MOD: usize = 2147483647;
#[macro_export]
macro_rules! max {
($x: expr) => ($x);
($x: expr, $( $y: expr ),+) => {
std::cmp::max($x, max!($( $y ),+))
}
}
#[macro_export]
macro_rules! min {
($x: expr) => ($x);
($x: expr, $( $y: expr ),+) => {
std::cmp::min($x, min!($( $y ),+))
}
}
fn main() {
input! {
N:usize,
K:i64,
H:[usize;N],
pos:[(i64,i64);N],
}
let K = K * K;
let mut graph = vec![vec![]; N];
for i in 0..N {
for j in 0..N {
if i == j {
continue;
}
let dist = (pos[i].0 - pos[j].0).pow(2) + (pos[i].1 - pos[j].1).pow(2);
if dist <= K && H[i] > H[j] {
graph[j].push(i);
}
}
}
let mut ans = 0;
for i in 0..N {
if graph[i].is_empty() {
ans += 1;
}
}
println!("{}", ans);
}