結果
問題 | No.2923 Mayor's Job |
ユーザー | loop0919 |
提出日時 | 2024-06-15 17:22:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 151 ms / 2,000 ms |
コード長 | 850 bytes |
コンパイル時間 | 434 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 77,756 KB |
最終ジャッジ日時 | 2024-09-15 21:16:21 |
合計ジャッジ時間 | 2,543 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
53,376 KB |
testcase_01 | AC | 43 ms
53,504 KB |
testcase_02 | AC | 43 ms
53,504 KB |
testcase_03 | AC | 151 ms
77,756 KB |
testcase_04 | AC | 91 ms
77,184 KB |
testcase_05 | AC | 105 ms
77,440 KB |
testcase_06 | AC | 129 ms
77,440 KB |
testcase_07 | AC | 103 ms
77,312 KB |
testcase_08 | AC | 102 ms
77,184 KB |
testcase_09 | AC | 113 ms
77,728 KB |
testcase_10 | AC | 107 ms
77,440 KB |
testcase_11 | AC | 96 ms
77,056 KB |
testcase_12 | AC | 106 ms
77,440 KB |
testcase_13 | AC | 56 ms
58,112 KB |
testcase_14 | AC | 47 ms
55,168 KB |
testcase_15 | AC | 43 ms
53,760 KB |
testcase_16 | AC | 42 ms
54,144 KB |
testcase_17 | AC | 43 ms
54,088 KB |
testcase_18 | AC | 43 ms
54,272 KB |
testcase_19 | AC | 43 ms
53,376 KB |
ソースコード
from collections import defaultdict N, K = map(int, input().split()) assert 1 <= N <= 2000 assert 1 <= K <= 10**9 H = list(map(int, input().split())) assert all(1 <= h <= 10**9 for h in H) points = defaultdict(list) for i in range(N): X, Y = map(int, input().split()) assert 1 <= X <= 10**9 assert 1 <= Y <= 10**9 points[H[i]].append((X, Y)) # 末尾に不要な入力がないかチェック try: input() exit(1) except EOFError: pass existing = [] for h in sorted(points.keys()): reject = set() for X, Y in points[h]: for i, (x, y) in enumerate(existing): if (X - x)**2 + (Y - y)**2 <= K**2: reject.add(i) new_existing = [] for i, (X, Y) in enumerate(existing): if i not in reject: new_existing.append((X, Y)) for X, Y in points[h]: new_existing.append((X, Y)) existing = new_existing print(len(existing))