CF332C Students' Revenge
题目描述
系主任每天要处理繁重的事务,但学生们对她非常反感。现在有 $n$ 个任务,学生们先选出 $p$ 个,系主任再在其中选出 $k$ 个来完成。
对于第 $i$ 项任务,完成它会使系主任的头发变白 $a_i$,不完成就会使校领导的不满意度增加 $b_i$。系主任会先使校领导的不满意度尽可能少,在此基础上使自己的头发变白尽可能少。
但是学生们想要使系主任的头发变白尽可能多,其次使得校领导的不满意度尽可能大。
请你帮学生们求他们应该选择的 $p$ 个数。
输入格式
输入共 $n+1$ 行,第 $1$ 行分别为为 $n,p,k$,代表有 $n$ 个任务,学生们选出 $p$ 个,系主任从这 $p$ 个中选出 $k$ 个来完成。
接下来的 $n$ 行,每行两个整数,第 $i$ 行的 $a_i,b_i$ 分别表示完成第 $i$ 项任务会使系主任的头发变白多少,不完成第 $i$ 项任务会使校领导的不满意度增加多少。
$1\le k\le p\le n\le 10^5,1\le a_i,b_i\le 10^9$。
输出格式
按任意顺序输出 $p$ 个整数,表示学生们应该选哪 $p$ 个任务。
说明/提示
In the first sample one of optimal solutions is to pass orders 1, 2, 3. In this case the chairperson obeys orders number 1 and 2. She gets 10 new grey hairs in the head and the directors' displeasement will equal 3. Note that the same result can be achieved with order 4 instead of order 3.
In the second sample, the chairperson can obey all the orders, so the best strategy for the students is to pick the orders with the maximum sum of $ a_{i} $ values. The chairperson gets 58 new gray hairs and the directors' displeasement will equal 0.