Logo
(追記) (追記ここまで)

30925번 - Lucky Draws 2 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB733100.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 $K$ draws in advance so that the most teams win. A team can win multiple times but is considered to have won once.

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.

제한

예제 입력 1

7 5
1 2
1 4
3 6
4 7
5 6

예제 출력 1

3
5
5
5
5
5
5

예제 입력 2

5 3
2 4
1 3
3 5

예제 출력 2

3
3
3
3
3

예제 입력 3

5 4
2 3
1 1
4 5
4 5

예제 출력 3

2
3
4
4
4

예제 입력 4

9 7
5 6
7 9
7 7
1 4
2 3
4 7
4 7

예제 출력 4

4
6
7
7
7
7
7
7
7

예제 입력 5

3 3
1 1
1 2
3 3

예제 출력 5

2
3
3

예제 입력 6

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

예제 출력 6

5
7
9
11
12
12
12
12
12
12
12
12

예제 입력 7

3 3
1 1
1 2
3 3

예제 출력 7

2
3
3

예제 입력 8

4 4
1 1
2 2
3 3
4 4

예제 출력 8

1
2
3
4

예제 입력 9

3 6
1 1
1 2
1 2
2 3
2 3
3 3

예제 출력 9

4
6
6

예제 입력 10

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

예제 출력 10

7
11
12
13
14
15
15
15
15
15
15
15
15
15
15
15
15
15
15
15

힌트

출처

  • 문제를 번역한 사람: koosaga
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /