| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 | 1024 MB | 7 | 3 | 3 | 100.000% |
The ICPC committee is planning a surprise event to cheer on the participating teams. The committee provides each team with a pair of two numbers, $A$ and $B$ (1ドル ≤ A ≤ B ≤ m$), before the competition, which will be used for the lucky draws after the competition. The committee wants to hold $K$ draws. In each draw, a single number $C$ is chosen by the committee, and all teams with a pair $(A, B)$ such that $A ≤ C ≤ B$ win in this draw. To make more teams happy, the committee wants to choose the $K$ numbers used in the
For example, five teams are participating in ICPC and their pairs are $(1, 2),ドル $(1, 4),ドル $(3, 6),ドル $(4, 7),ドル $(5, 6),ドル and $K = 2$. When the committee chooses two numbers 2ドル$ and 4ドル$ , four teams with $(1, 2),ドル $(1, 4),ドル $(3, 6)$ and $(4, 7)$ win. The team with $(1, 4)$ wins twice because the pair contains both chosen numbers. In fact, all five teams can win if 2ドル$ and 5ドル$ are chosen. The maximum number of winning teams is five.
Given $n$ pairs of two integers for teams, write a program to output the maximum number of winning teams for all possible $K = 1, 2, \ldots, m$.
Your program is to read from standard input. The input starts with a line containing two integers, $m$ and $n$ (1ドル ≤ m, n ≤ 1,000円,000円$), where $m$ is the upper bound of the numbers provided to teams and $n$ is the number of teams. Each of the following $n$ lines contains two integers $A$ and $B$ that represent the pair of a team, where 1ドル ≤ A ≤ B ≤ m$.
Your program is to write to standard output. Print exactly $m$ lines. The $i$-th line should contain the maximum number of winning teams given that $K = i$. Teams that win more than once should only be counted once.
7 5 1 2 1 4 3 6 4 7 5 6
3 5 5 5 5 5 5
5 3 2 4 1 3 3 5
3 3 3 3 3
5 4 2 3 1 1 4 5 4 5
2 3 4 4 4
9 7 5 6 7 9 7 7 1 4 2 3 4 7 4 7
4 6 7 7 7 7 7 7 7
3 3 1 1 1 2 3 3
2 3 3
12 12 5 5 11 12 3 3 6 9 9 10 5 5 6 10 11 12 2 9 1 3 3 8 7 7
5 7 9 11 12 12 12 12 12 12 12 12
3 3 1 1 1 2 3 3
2 3 3
4 4 1 1 2 2 3 3 4 4
1 2 3 4
3 6 1 1 1 2 1 2 2 3 2 3 3 3
4 6 6
20 15 15 19 1 8 6 11 3 11 11 17 6 6 16 20 7 11 11 14 2 19 1 3 7 7 6 19 14 15 15 15
7 11 12 13 14 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15