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):
## import



## main process
if __name__ == '__main__':
    
    ## input
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    ROAD_LIST = []
    for j in range(M): 
        ROAD_LIST.append(
            tuple(map(int,input().split()))
        )
    
    ## business logic
    ans = [1] * N
    for j in list(range(M)):
        point_a = ROAD_LIST[j][0]
        point_b = ROAD_LIST[j][1]

        point_a =- 1
        point_b =- 1

        height_a = HEIGHT_LIST[point_a]
        height_b = HEIGHT_LIST[point_b]

        if height_a < height_b:
            ans[point_a] = 0
        elif height_a > height_b:
            ans[point_b] = 0
        else:
            ans[point_a] = 0
            ans[point_b] = 0

    ## output
    print(sum(ans))

    ## input
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    ROAD_LIST = []
    for j in range(M): 
        ROAD_LIST.append(
            set(map(int,input().split()))
        )
    
    ## business logic
    COUNT = 0
    
    for i in list(range(1, N+1)):
        unioned_i = set([])
        for k in ROAD_LIST:
            if i in k:
                unioned_i = unioned_i | k
        if len(unioned_i) == 0:
            COUNT = COUNT + 1
            continue
        HIGHT_i = HEIGHT_LIST[i-1]
        if HIGHT_i >= max(
            [ HEIGHT_LIST[l-1] for l in list(unioned_i) ]
        ):
            COUNT = COUNT + 1
    
    ## output
    print(COUNT)

## import



## main process
if __name__ == '__main__':
    
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    
    ans = [1] * N
    for j in range(M):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        height_a = HEIGHT_LIST[a]
        height_b = HEIGHT_LIST[b]

        if height_a < height_b:
            ans[point_a] = 0
        elif height_a > height_b:
            ans[point_b] = 0
        else:
            ans[point_a] = 0
            ans[point_b] = 0

    print(sum(ans))

## import



## main process
if __name__ == '__main__':
    
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    
    ans = [1] * N
    for j in range(M):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        height_a = HEIGHT_LIST[a]
        height_b = HEIGHT_LIST[b]

        if height_a < height_b:
            ans[point_a] = 0
        elif height_a > height_b:
            ans[point_b] = 0
        else:
            ans[point_a] = 0
            ans[point_b] = 0
    print(sum(ans))

## import



## main process
if __name__ == '__main__':
    
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    
    ans = [1] * N
    for j in range(M):
        a, b = map(int,input().split())
        a -= 1
        b -= 1
        height_a = HEIGHT_LIST[a]
        height_b = HEIGHT_LIST[b]

        if height_a < height_b:
            ans[a] = 0
        elif height_a > height_b:
            ans[b] = 0
        else:
            ans[a] = 0
            ans[b] = 0

    print(sum(ans))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted