No.1032 Counting Numbers
タグ : / 解いたユーザー数 208
作問者 :
Problem Statement
You are given a sequence $L$ of length $N$ consisting of natural numbers $L_1$, $L_2$, ..., $L_N$.
For every natural number from $1$ to $M$, output how many times it appears in $L$, following the format below.
[Output Format]
$1$ the number of times 1 appears in $L$
$2$ the number of times 2 appears in $L$
$3$ the number of times 3 appears in $L$
...
$M$ the number of times $M$ appears in $L$
Input
$N$ $M$ $L_1$ $L_2$ ... $L_N$
$1$ ≦ $N$, $M$ ≦ $2$ x $10^5$
$1$ ≦ $L_i$ ≦ $2$ x $10^5$
Output
Output the answer following the format.
Sample
Sample 1
Input
5 4 3 1 4 1 5
Output
1 2 2 0 3 1 4 1
Among 1 to 4, in the given sequence 1 appears 2 times, 2 appears 0 times, 3 appears 1 time, and 4 appears 1 time, so the output is as shown.
5 also appears, but it is ignored because it is not included in 1 to 4.
Sample 2
Input
8 2 9 8 7 6 5 4 3 2
Output
1 0 2 1
Sample 3
Input
11 9 1 7 3 20 50 80 7 5 6 8 8
Output
1 1 2 0 3 1 4 0 5 1 6 1 7 2 8 2 9 0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。