結果

問題 No.2923 Mayor's Job
ユーザー lif4635lif4635
提出日時 2024-10-13 02:16:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 2,570 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 82,076 KB
実行使用メモリ 121,892 KB
最終ジャッジ日時 2024-10-13 02:16:20
合計ジャッジ時間 3,215 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,360 KB
testcase_01 AC 37 ms
52,812 KB
testcase_02 AC 37 ms
54,056 KB
testcase_03 AC 127 ms
76,972 KB
testcase_04 AC 239 ms
121,892 KB
testcase_05 AC 170 ms
77,420 KB
testcase_06 AC 134 ms
76,968 KB
testcase_07 AC 128 ms
76,764 KB
testcase_08 AC 141 ms
76,980 KB
testcase_09 AC 131 ms
76,964 KB
testcase_10 AC 141 ms
77,280 KB
testcase_11 AC 220 ms
112,152 KB
testcase_12 AC 183 ms
97,208 KB
testcase_13 AC 82 ms
77,564 KB
testcase_14 AC 51 ms
64,804 KB
testcase_15 AC 36 ms
53,456 KB
testcase_16 AC 35 ms
53,016 KB
testcase_17 AC 34 ms
53,740 KB
testcase_18 AC 37 ms
55,000 KB
testcase_19 AC 38 ms
54,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""input"""
#int-input
# input = sys.stdin.readline
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
#str-input
def SI(): return input()
def MSI(): return input().split()
def SI_L(): return list(SI())
def SI_LI(): return list(map(int, SI()))
#multiple-input
def LLI(n): return [LI() for _ in range(n)]
def LSI(n): return [SI() for _ in range(n)]
#1-indexを0-indexでinput
def MI_1(): return map(lambda x:int(x)-1, input().split())
def TI_1(): return tuple(MI_1())
def LI_1(): return list(MI_1())

class dsu():
    n=1
    parent_or_size=[-1 for i in range(n)]
    def __init__(self,N):
        self.n=N
        self.parent_or_size=[-1 for i in range(N)]
    def merge(self,a,b):
        assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
        assert 0<=b<self.n, "0<=b<n,b={0},n={1}".format(b,self.n)
        x=self.leader(a)
        y=self.leader(b)
        if x==y:
            return x
        if (-self.parent_or_size[x]<-self.parent_or_size[y]):
            x,y=y,x
        self.parent_or_size[x]+=self.parent_or_size[y]
        self.parent_or_size[y]=x
        return x
    def same(self,a,b):
        assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
        assert 0<=b<self.n, "0<=b<n,b={0},n={1}".format(b,self.n)
        return self.leader(a)==self.leader(b)
    def leader(self,a):
        assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
        if (self.parent_or_size[a]<0):
            return a
        self.parent_or_size[a]=self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]
    def size(self,a):
        assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
        return -self.parent_or_size[self.leader(a)]
    def groups(self):
        leader_buf=[0 for i in range(self.n)]
        group_size=[0 for i in range(self.n)]
        for i in range(self.n):
            leader_buf[i]=self.leader(i)
            group_size[leader_buf[i]]+=1
        result=[[] for i in range(self.n)]
        for i in range(self.n):
            result[leader_buf[i]].append(i)
        result2=[]
        for i in range(self.n):
            if len(result[i])>0:
                result2.append(result[i])
        return result2

n,k = MI()
h = LI()
p = LLI(n)

uf = dsu(n)

def dis(p,q):
    return (p[0]-q[0])**2 + (p[1]-q[1])**2


edge = [set() for i in range(n)]
for i in range(n):
    for j in range(n):
        if h[i] < h[j] and dis(p[i],p[j]) <= k**2:
            edge[i].add(j)

ans = 0
for i in range(n):
    if edge[i] == set():
        ans += 1
print(ans)
0