当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6249:Alice’s Stamps

题目描述
Alice likes to collect stamps. She is now at the post office buying some new stamps.
There are $N$ different kinds of stamps that exist in the world; they are numbered $1$ through $N$. However, stamps are not sold individually; they must be purchased in sets. There are $M$ different stamp sets available; the $i^{th}$ set contains the stamps numbered $L_i$ through $R_i$. The same stamp might appear in more than one set, and it is possible that one or more stamps are not available in any of the sets.
All of the sets cost the same amount; because Alice has a limited budget, she can buy at most $K$ different sets. What is the maximum number of different kinds of stamps that Alice can get?
输入解释
The input starts with one line containing one integer $T$, the number of test cases.$T$ test cases follow.
Each test case begins with a line containing three integers: $N$, $M$, and $K$: the number of different kinds of stamps available, the number of stamp sets available, and the maximum number of stamp sets that Alice can buy.
$M$ lines follow; the $i^{th} of these lines represents the $i^{th} stamp set and contains two integers, $L_i$ and $R_i$, which represent the inclusive range of the numbers of the stamps available in that set.
$1 \leq T \leq 100$
$1 \leq K \leq M$
$1 \leq N, M \leq 2000$
$1 \leq L_i \leq R_i \leq N$
输出解释
For each test case, output one line containing “Case #x: y”, where $x$ is the test case number (starting from 1) and $y$ is the maximum number of different kinds of stamp that Alice could get.
输入样例
2
5 3 2
3 4
1 1
1 3
100 2 1
1 50
90 100
输出样例
Case #1: 4
Case #2: 50
提示
In sample case #1, Alice could buy the first and the third stamp sets, which contain the first four kinds
of stamp. Note that she gets two copies of stamp 3, but only the number of different kinds of stamps
matters, not the number of stamps of each kind.
In sample case #2, Alice could buy the first stamp set, which contains 50 different kinds of stamps.
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6249

最后修改于 2020-10-25T23:29:40+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 65536/65536K(Java/Others)