## Champion Contest

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

gunners101101 likes to play LOL (League of Legends). He currently has a list of champions, each with a value , denoting how good the champion is. If a champion has a higher value than another champion, , then will win in a 1 on 1 fight with champion .

However, due to some lore hidden in this game, some champions are friends with other champions, as such, they refuse to fight, and the result of their fight will be a draw.

You are given champions, and friendships. You are to find the number of champions each champion can defeat.

#### Input Specification

First line, two integers and , denoting the number of champions and number of friendships.

Second line, space separated integers denoting the value of each champion.

Next lines, two integers and , denoting that and are friends.

#### Output Specification

For each champion, output the number champions that they can defeat, output the answer on one line separated by spaces.

#### Constraints

• All pairs of and are unique, and

#### Sample Input

4 2
10 4 10 15
1 2
4 3

#### Sample Output

0 0 1 2

#### Explanation for Sample Output

The first champion can only win against the second champion, but since they are friends, he cannot defeat any champion. The second champion has the lowest value, and thus he cannot defeat any other champion. The third champion can only defeat the second champion. The last champion can defeat all the champions except for the third champion, as they are friends.