Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M=map(int,input().split())
hs=input().split()

H=[0]                           
for h in hs:
    H.append(int(h))


P=[[0]*1 for i in range(N+1)]   
count=0
for p in range(len(P)):
    P[p][0]=p                   
# print(P)

for m in range(M):
    pathfrom,pathto= map (int,input().split())
    P[pathfrom].append(H[pathto])
    P[pathto].append(H[pathfrom])
print(P)
for i in range(1,len(P)):
    P[i][0]=H[i]
    if P[i][0]>=max(P[i]):
        count+=1
print(count)

N,M=map(int,input().split())
hs=input().split()
H=[0]                           
P=[[0]*1 for i in range(N+1)]   
count=0
for p in range(len(P)):
    P[p][0]=p
# print(P)
for h in hs:
    H.append(int(h))

for m in range(M):
    pathfrom,pathto= map (int,input().split())
    P[pathfrom].append(H[pathto])
    P[pathto].append(H[pathfrom])
for i in range(1,len(P)):
    P[i][0]=H[i]
    if P[i][0]>max(P[i]):
        count+=1
print(count)

N,M=map(int,input().split())
hs=input().split()
H=[0]
P=[[0]*1 for i in range(N+1)]       
count=0
for p in range(len(P)):
    P[p][0]=p
# print(P)
for h in hs:
    H.append(int(h))

for m in range(M):
    pathfrom,pathto= map (int,input().split())
    P[pathfrom].append(H[pathto])
    P[pathto].append(H[pathfrom])
for i in range(len(P)):
    P[i][0]=H[i]
    if P[i][0]>max(P[i]):
        count+=1
print(count)

N,M=map(int,input().split())
hs=input().split()
H=[0]
P=[[0]*1 for i in range(N+1)]       
count=0
for p in range(len(P)):
    P[p][0]=p
# print(P)
for h in hs:
    H.append(int(h))

for m in range(M):
    pathfrom,pathto= map (int,input().split())
    P[pathfrom].append(H[pathto])
    P[pathto].append(H[pathfrom])
for i in range(len(P)):
    P[i][0]=H[i]
    if P[i][0]>=max(P[i]):
        count+=1
print(count)

N,M=map(int,input().split())
hs=input().split()

H=[0]                           
for h in hs:
    H.append(int(h))


P=[[0]*1 for i in range(N+1)]   
count=0
for p in range(len(P)):
    P[p][0]=p                   
# print(P)

for m in range(M):
    pathfrom,pathto= map (int,input().split())
    P[pathfrom].append(H[pathto])
    P[pathto].append(H[pathfrom])
for i in range(1,len(P)):
    P[i][0]=H[i]
    if P[i][0]>max(P[i]) and len(P[i])>1:
        count+=1
print(count)

N,M=map(int,input().split())
hs=input().split()

H=[0]                           
for h in hs:
    H.append(int(h))


P=[[0]*1 for i in range(N+1)]   
count=0
for p in range(len(P)):
    P[p][0]=p                   
# print(P)

for m in range(M):
    pathfrom,pathto= map (int,input().split())
    P[pathfrom].append(H[pathto])
    P[pathto].append(H[pathfrom])
for i in range(1,len(P)):
    if len(P[i])==1:
        count+=1
    else:
        P[i][0]=H[i]
        _rP=P[i][1:]
        if P[i][0]>max(_rP):
            count+=1
print(count)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted