結果

問題 No.2923 Mayor's Job
コンテスト
ユーザー 回転
提出日時 2025-05-15 07:46:43
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 508 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 231 ms
コンパイル使用メモリ 95,092 KB
実行使用メモリ 84,736 KB
最終ジャッジ日時 2026-07-10 17:08:39
合計ジャッジ時間 3,330 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
a = []
for i in range(N):
    x,y = list(map(int,input().split()))
    a.append((x,y,i))
a.sort(key=lambda x:H[x[2]])

ans = set()
for x,y,idx in a:
    flag = True
    remove_memo = []
    for xx,yy,idx2 in ans:
        if((x-xx)*(x-xx) + (y-yy)*(y-yy) <= K*K and H[idx] > H[idx2]):
            remove_memo.append((xx,yy,idx2))
    for xx,yy,idx2 in remove_memo:
        ans.remove((xx,yy,idx2))
    ans.add((x,y,idx))

print(len(ans))
0