結果
問題 |
No.2923 Mayor's Job
|
ユーザー |
![]() |
提出日時 | 2025-01-31 23:51:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 196 ms / 2,000 ms |
コード長 | 1,172 bytes |
コンパイル時間 | 511 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 82,872 KB |
最終ジャッジ日時 | 2025-01-31 23:51:53 |
合計ジャッジ時間 | 4,567 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
from collections import * from itertools import * from functools import cache, partial from pprint import pprint import sys from typing import Any, Final try: from icecream import ic except ImportError: # Graceful fallback if IceCream isn't installed. ic = lambda *a: None if not a else (a[0] if len(a) == 1 else a) # noqa debug = partial(print, file=sys.stderr) dpprint = partial(pprint, stream=sys.stderr) sys.setrecursionlimit(10**6) MOD = 998244353 N, K = list(map(int, input().split())) H_ = list(map(int, input().split())) H = [(h, i) for i, h in enumerate(H_)] H.sort() # ic(H) XY = [] for _ in range(N): x, y = map(int, input().split()) XY.append((x, y)) destroied = [False] * N for s, t in groupby(H, key=lambda x: x[0]): T = set([x for _, x in t]) # ic(s, T) for i in T: xi, yi = XY[i] for j, (x, y) in enumerate(XY): if j in T: continue if destroied[j]: continue xj, yj = x, y if (xi - xj) ** 2 + (yi - yj) ** 2 <= K**2: destroied[i] = True break # ic(destroied) ans = N - sum(destroied) print(ans)