結果

問題 No.2923 Mayor's Job
ユーザー 回転
提出日時 2025-05-15 07:46:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 82,664 KB
実行使用メモリ 77,744 KB
最終ジャッジ日時 2025-05-15 07:46:47
合計ジャッジ時間 3,405 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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