問題一覧 > 通常問題

No.2154 Number of Asakatsu Participants

レベル : / AI推定難易度 : 500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 208
作問者 : Michirakara / テスター : kotamanegi KowerKoint2010 hibit_at mo124121
お気に入りにしたユーザー ProblemId : 8384 / 自分の提出
問題文最終更新日: 2022-12-09 19:19:01
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 371 (Asakatsu Presents) (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。