NC222454. [USACOJan2021G&S]DanceMooves
描述
输入描述
The first line contains integers N, K, and M. Each of the next K lines contains (a1,b1),(a2,b2),…,(aK,bK) (1≤ai<bi≤N).
输出描述
Print N lines of output, where the ith line contains the number of unique positions that cow i reaches.
示例1
输入:
6 4 7 1 2 2 3 3 4 4 5
输出:
5 4 3 3 3 1
说明:
After 7 minutes, the cows in increasing order of position are [3,4,5,2,1,6].
Cow 1 reaches positions {1,2,3,4,5}.
Cow 2 reaches positions {1,2,3,4}.
Cow 3 reaches positions {1,2,3}.
Cow 4 reaches positions {2,3,4}.
Cow 5 reaches positions {3,4,5}.
Cow 6 never moves, so she never leaves position 6.