QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100

#914. Cloning Technique

Estadísticas

Yiai has $n$ courses to take this semester. However, because she really wants to slack off, she decides to assign the courses to her clones. The $i$-th course occupies the time interval $(l_i, r_i)$. If Yiai assigns a set of courses $S$ to a clone, the courses must not overlap in time; that is, for any $i, j \in S$ ($i \neq j$), we must have $(l_i, r_i) \cap (l_j, r_j) = \varnothing$.

For each $k$ ($1 \le k \le m$), Yiai wants to calculate the maximum total number of courses that can be taken if she has $k$ clones.

Input

The first line contains two positive integers $n$ and $m$, representing the number of courses and the maximum number of clones, respectively.

The next $n$ lines each contain two positive integers $l_i$ and $r_i$, representing the time interval occupied by the $i$-th course.

Output

Output $m$ lines, each containing a positive integer, representing the maximum total number of courses that can be taken by $k$ clones, for $k = 1, 2, \dots, m$.

Examples

Input 1

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

Output 1

4
6
6

Subtasks

For $100\%$ of the data, it is guaranteed that $1 \le m \le n \le 3 \times 10^5$ and $1 \le l_i < r_i \le 10^9$.

Test Case ID $n$ $m$
$1$ $100$ $10$
$2$ $100$
$3$ $1000$ $1000$
$4$ $3000$ $3000$
$5$ $10^5$ $10$
$6$ $100$
$7$ $10^5$
$8$ $3\times 10^5$ $10$
$9$ $100$
$10$ $3\times 10^5$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.