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

建议使用的浏览器:

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

6003:Problem Buyer

题目描述
TopSetter is an organization that creates problems. They’ve prepared N problems with estimated difficulty score in range [ $A_i , B_i$ ]. TopHoster would like to host a contest consisting of M problems.
The $i^{th}$ problem should be of difficulty score $C_i$. The $i^{th}$ problem from TopSetter can be used in the contest if and only if its estimated difficulty score range $[A_i, B_i]$ covers the difficulty score c of its target problem in the contest, i.e. $A_i ≤ c ≤ B_i$ . Hosting a contest with M problems needs tohave M distinct problems which satisfy the required difficulty scores for each problem.
Unfortunately, TopSetter doesn’t provide a service to buy specific problems. You can only request a problem set containing K problems and they will give you K distinct problems from all the N problems, but you don’t know which problems will be given.
As TopSetter is the only problem provider for TopHoster, TopHoster would like to know the least number K of problems they need to buy to make sure they can host a contest.
输入解释
The first line of the input gives the number of test cases, T. T test cases follow. Each test case starts with 2 integers, N and M. Then N lines follow, each line consists of 2 integers representing the difficulty score range of the $i^{th}$ problem, $A_i and B_i$ . The last line of each test case consists of M integers representing the target difficulty scores of the M problems $C_i$ .
输出解释
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 least number of problems which the TopHoster needs to buy.
Output “IMPOSSIBLE!” if it’s impossible.

limits


$\bullet 1 ≤ T ≤ 100.$
$\bullet 1 ≤ N, M ≤ 10^5.$
$\bullet 1 ≤ A_i ≤ B_i ≤ 10^9.$
$\bullet 1 ≤ C_i ≤ 10^9.$
输入样例
3
3 1
1 4
2 3
5 6
3
3 2
1 10
3 4
7 9
4 8
3 3
1 2
5 6
8 9
1 5 10
输出样例
Case #1: 2
Case #2: 2
Case #3: IMPOSSIBLE!
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

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

题目来源 2016 CCPC-Final

源链接: HDU-6003

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

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 32768/32768K(Java/Others)