cswork / OA打开练习工作台

CitadelOA #9

Max Earnings with Schedule Changes

估计中等可在线判题

考点(AI 标注)贪心调度

A workday earns fixedPay, plus an extra bonus if the previous day was also a workday. You may change at most k rest days 0 into workdays 1; existing workdays cannot be removed. Find the maximum income. In the original example 100101, changing two days can give 111101; the old explanation missed one digit, and the correct income is 29.

输入格式

The first line contains n k fixedPay bonus, and the second line contains a 01 string; complete OCR bounds 1≤k≤n≤200000, 1≤fixedPay,bonus≤10^9.

输出格式

Output a single integer, the answer.

样例 1

输入:

5 2 1 2
10100

输出:

10

样例 2

输入:

6 2 4 3
100101

输出:

29

样例 3

输入:

7 1 3 3
1111001

输出:

30

样例说明

The outputs of the three public examples are, in order: 10; 29; 30. These answers were verified by independent enumeration or direct simulation.