#P10428. [蓝桥杯 2024 省 B] 爬山

    ID: 19897 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度NOI/NOI+/CTS 上传者: 标签>数学贪心2024凸完全单调性(wqs 二分)蓝桥杯省赛根号分治

[蓝桥杯 2024 省 B] 爬山

Problem Description

This problem is suspected to be incorrect. So far, there is no algorithm that can produce the correct solution for all inputs within the given time limit.

Xiaoming is taking part in a company team-building activity, and the activity is mountain climbing. On the xx axis, there are nn mountains from left to right. The height of the ii-th mountain is hih_i. They need to climb all the mountains from left to right in order, and the stamina cost is S=∑i=1nhiS = \sum_{i=1}^n h_i.

However, Xiaoming secretly learned magic that can reduce the heights of some mountains. He knows two types of magic. The first type can change the height of a mountain with height HH to ⌊H⌋\lfloor\sqrt{ H }\rfloor, and it can be used PP times. The second type can change the height of a mountain with height HH to ⌊H2⌋\left\lfloor\frac{H}{2}\right\rfloor, and it can be used QQ times. For each mountain, these two types of magic can be cast multiple times in any order.

Xiaoming wants to plan which mountains to use magic on so that the stamina cost of climbing is minimized. What is the minimum possible stamina cost in the optimal case?

Input Format

The input has two lines.
The first line contains three integers nn, PP, QQ.
The second line contains nn integers h1h_1, h2h_2, …\ldots, hnh_n.

Output Format

Output one line with one integer, which is the answer.

4 1 1
4 5 6 49

18

Hint

  • For 20%20\% of the testdata, n≤8n \leq 8, P=0P = 0.
  • For all testdata, it is guaranteed that 1≤n≤1051 \leq n \leq 10^5, 0≤P,Q≤n0 \leq P, Q \leq n, 0≤hi≤1050 \leq h_i \leq 10^5.

Translated by ChatGPT 5