#B2096. Count Occurrences in Array
Count Occurrences in Array
Count Occurrences in Array
Given a non-negative integer array, count the occurrence of each integer from 0 to Fmax, where \(Fmax\) is the maximum number in the array and satisfies \(Fmax \leq 100000\).
You are required to output the counts for all integers in the set \(\{0, 1, 2, \ldots, Fmax\}\).
For example, if the input array is [0, 1, 2, 2, 5], the maximum value is 5. Thus, you need to print the counts of 0, 1, 2, 3, 4, 5 respectively.
inputFormat
The input consists of two lines:
- The first line contains an integer \(n\) denoting the number of elements in the array.
- The second line contains \(n\) non-negative integers separated by spaces.
outputFormat
Output a single line containing \(Fmax+1\) integers. The \(i\)-th integer (starting from 0) represents the number of occurrences of \(i\) in the array. The integers should be separated by a single space.
sample
5
0 1 2 2 5
1 1 2 0 0 1