CF976E.Well played!
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:
Max owns n creatures, i-th of them can be described with two numbers — its health hp__i and its damage dmg__i. Max also has two types of spells in stock:
- Doubles health of the creature (hp__i := hp__i·2);
- Assigns value of health of the creature to its damage (dmg__i := hp__i).
Spell of first type can be used no more than a times in total, of the second type — no more than b times in total. Spell can be used on a certain creature multiple times. Spells can be used in arbitrary order. It isn't necessary to use all the spells.
Max is really busy preparing for his final exams, so he asks you to determine what is the maximal total damage of all creatures he can achieve if he uses spells in most optimal way.
最近,Max 迷上了热门集换式卡牌游戏(CCG)“BrainStone”。由于“BrainStone”是一款极具智力挑战性的游戏,Max 在游玩过程中需要解决大量难题。以下是其中一道:
Max 拥有 n 个生物,第 i 个生物可用两个数值描述:其生命值 hpi 和其攻击力 dmgi。Max 手中还有两类法术:
- 将某个生物的生命值翻倍(即 hpi:=hpi⋅2);
- 将某个生物当前的生命值赋给其攻击力(即 dmgi:=hpi)。
第一类法术总共最多可使用 a 次,第二类法术总共最多可使用 b 次。同一生物可多次施放同一法术。法术可以按任意顺序施放,且不强制用完所有法术。
Max 正忙于准备期末考试,因此请你帮他计算:若以最优方式施放法术,他所能达到的所有生物总攻击力的最大值是多少?
输入格式
The first line contains three integers n, a, b (1 ≤ n ≤ 2·105, 0 ≤ a ≤ 20, 0 ≤ b ≤ 2·105) — the number of creatures, spells of the first type and spells of the second type, respectively.
The i-th of the next n lines contain two number hp__i and dmg__i (1 ≤ hp__i, dmg__i ≤ 109) — description of the i-th creature.
第一行包含三个整数 n、a、b(1 ≤ n ≤ 2⋅105,0 ≤ a ≤ 20,0 ≤ b ≤ 2⋅105),分别表示生物的数量、第一类法术的数量和第二类法术的数量。
接下来的 n 行中,第 i 行包含两个数 hpi 和 dmgi(1 ≤ hpi,dmgi ≤ 109),表示第 i 个生物的生命值和攻击力。
输出格式
Print single integer — maximum total damage creatures can deal.
输出一个整数——生物所能造成的最大总伤害。
输入输出样例
输入#1
2 1 1 10 15 6 1
输出#1
27
输入#2
3 0 3 10 8 7 11 5 2
输出#2
26
说明/提示
In the first example Max should use the spell of the first type on the second creature, then the spell of the second type on the same creature. Then total damage will be equal to 15 + 6·2 = 27.
In the second example Max should use the spell of the second type on the first creature, then the spell of the second type on the third creature. Total damage will be equal to 10 + 11 + 5 = 26.
在第一个例子中,Max 应当对第二个生物使用第一种法术,然后对同一生物使用第二种法术。此时总伤害为 15+6⋅2=27。
在第二个例子中,Max 应当对第一个生物使用第二种法术,然后对第三个生物使用第二种法术。此时总伤害为 10+11+5=26。
输入解题思路,AI测评打分。不知道怎么写?