#P15532. 【MYCOI R1】好想大声说爱你

    ID: 14889 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>贪心洛谷原创O2优化洛谷月赛

【MYCOI R1】好想大声说爱你

Description

There are nn children standing in a row. The height of the ii-th child is aia_i centimeters.

As a magician, you have two types of magic:

  • "Lock": Point your wand at a child.
  • "Grow": Increase the height of the **last child whom your wand is pointing to by 11 centimeter. Note: If you have never performed "Lock" before, you cannot perform this magic.

The teacher thinks that if only one child keeps growing taller, the neighboring children might feel inferior. Therefore, the teacher requires that you may only perform the "Grow" magic if, within the LL children to the left (or up to the start of the line if fewer than LL exist) and the LL children to the right (or up to the end of the line if fewer than LL exist) of the chosen child, there is at least one child whose height is greater than or equal to the chosen child's height.

Since magic requires casting time, the teacher wants to know the minimum total number of magic actions (both "Grow" and "Lock") required to make every child’s height at least MM.

If it is impossible, output Che_is_Loser.

Input Format

The first line contains three positive integers nn, LL, MM.

The second line contains nn positive integers aia_i, separated by spaces.

A single positive integer representing the minimum number of operations required.

Output Format

A single positive integer representing the minimum number of operations required.

3 1 4
1 2 3
9
5 1 5
2 3 5 1 4
14
4 1 5
1 3 3 1
17

Hint

This problem uses bundled testing.

::cute-table{tuack}

Subtask Special Properties Points
Subtask 1 n,ai,M,L10n, a_i, M, L \leq 10 10
Subtask 2 Mmin{ai}M \leq \min\{a_i\} 1
Subtask 3 Mmax{ai}M \leq \max\{a_i\} 20
Subtask 4 aia_i is non-decreasing
Subtask 5 No special properties 49

For 100%100\% of the data, it is guaranteed that 2Ln1062 \leq L \leq n \leq 10^6, 1M,ai1091 \leq M, a_i \leq 10^9.