No.2154 Number of Asakatsu Participants
タグ : / 解いたユーザー数 208
作問者 :
Michirakara
/ テスター :
kotamanegi
KowerKoint2010
hibit_at
mo124121
Problem Statement
hibit holds a virtual contest called "Asakatsu" every morning, but he has lost the standings of the Asakatsu contests going back to $N$ days ago.
However, he remembers who participated and when.
There are $M$ participants in total, and the $i$-th person participated only in the Asakatsu contests from $L_i$ days ago through $R_i$ days ago, and did not participate on any other day.
For each day from $N$ days ago through yesterday, output the number of people who participated in Asakatsu that day, separated by newlines.
Input
$N\ M$ $L_1\ R_1$ $\vdots$ $L_M R_M$
- $1\leq N\leq 5\times 10^5$
- $1\leq M\leq 5\times 10^5$
- $1\leq R_i\leq L_i\leq N (1\leq i\leq M)$
- All inputs are integers.
Sample
Sample 1
Input
5 3 4 1 3 2 4 4
Output
0 2 2 2 1
The $1$st person participated from $4$ days ago through $1$ day ago, the $2$nd person from $3$ days ago through $2$ days ago, and the $3$rd person only $4$ days ago, so
the numbers of participants from $5$ days ago through $1$ day ago are $0,2,2,2,1$, respectively.
Sample 2
Input
1 1 1 1
Output
1
Sadly, it seems that hibit was the only one who participated in Asakatsu.
Sample 3
Input
9 8 2 1 7 3 8 2 6 4 5 5 8 3 3 2 8 8
Output
0 3 3 4 5 4 4 3 1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。