QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#914. 分身术

Statistics

忆艾这个学期要上 $n$ 门课。但是由于其很想摸鱼,决定优先把课丢给自己的分身。第 $i$ 门课有一个占据的时段 $(l_i, r_i)$,如果忆艾给一名分身分配了集合 $S$ 中的课,那么需要满足这些课的上课时刻不交,也就是说任取 $i,j\in S(i\neq j)$,那么应该有 $(l_i,r_i) \cap (l_j,r_j) = \varnothing$。

忆艾想对于每个 $k(1\le k\le m)$,算出总共有 $k$ 个分身的话,最多可以让他们帮忙上多少门课。

输入格式

第一行输入两个正整数 $n,m$,分别表示课程数量和最大分身数量。

接下来 $n$ 行每行两个正整数 $l_i,r_i$,从小到大表示第 $i$ 门课所占时段。

输出格式

共 $m$ 行每行一个正整数,从小到大表示 $k$ 个分身总共能上多少门课。

样例数据

样例 1 输入

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

样例 1 输出

4
6
6

子任务

对于 $100\%$ 的数据,保证 $1\le m\le n\le 3\times 10^5; 1\le l_i < r_i \le 10^9$。

测试点编号 $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$
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.