#P10073. [GDKOI2024 普及组] 刷野 II

[GDKOI2024 普及组] 刷野 II

Problem Description

Zayin is a wizard who fights monsters. This time, he will face nn monsters standing in a line, where the health of the ii-th monster is aia_i.

Zayin knows many forbidden spells. In this battle, he decides to use a spell called "Lightning Combo" to defeat all monsters at once. Let us see how this spell works.

  • First, Zayin chooses a monster i(1in)i(1 \leq i \leq n) and an initial spell power xx.
  • Then the spell first hits monster ii. After that, for every step except the first target, Zayin may choose a monster that has not been hit by this spell, and is adjacent to at least one monster that has already been hit.
  • The first monster hit takes xx damage, the second target takes x1x-1 damage, the third takes x2x-2 damage, and so on. It is not hard to see that each monster will be hit exactly once.

If the damage a monster takes is not less than its health, it is considered dead.

Zayin wants to show his skill as an advanced wizard, so under the condition that he can kill all monsters using only one spell, he wants to use the smallest possible initial power xx.

You need to find the minimum required initial power and provide a valid plan. If there are multiple different plans, you may output any one of them.

Input Format

The first line contains two integers d,nd, n, representing the test point id and the number of monsters.

The next line contains nn integers, where the ii-th integer aia_i denotes the health of the ii-th monster.

Output Format

The first line outputs an integer xx, the minimum initial power.

The second line outputs nn indices separated by spaces, monsteri(1in)monster_i(1 \leq i \leq n), where monsterimonster_i denotes the monster hit at the ii-th strike.

1 10
19 9 12 5 10 7 16 15 17 12
25
1 2 3 4 5 6 7 8 9 10

Hint

For all testdata, it is guaranteed that 1n5×1061 \leq n \leq 5 \times 10^6, and 1ai1091 \leq a_i \leq 10^9.

Test Point ID nn\leq
11 1010
22 2020
33 500500
44 50005000
55 5×1045\times 10^4
6,76,7 5×1055\times 10^5
8,9,108,9,10 5×1065\times 10^6

Translated by ChatGPT 5