Lizards and Basements 2 | JXNUOJ
描述:
This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced.
这是在原始比赛中的问题的简化版本。开始的问题有太多不同的解决方法。减少了对输入数据的约束。
Polycarp likes to play computer role-playing game «Lizards and Basements». At the moment he is playing it as a magician. At one of the last levels he has to fight the line of archers. The only spell with which he can damage them is a fire ball. If Polycarp hits the i-th archer with his fire ball (they are numbered from left to right), the archer loses a health points. At the same time the spell damages the archers adjacent to the i-th (if any) — they lose b (1 ≤ b < a ≤ 10) health points each.
Polycarp喜欢电脑玩角色扮演游戏《蜥蜴和地下室》。目前,他正在扮演魔术师的角色。在最后一关时,他需要和弓箭手联手。他唯一一个能有攻击性的就是火球。如果Polycard用火球攻击了第i个弓箭手(从左至右),弓箭手就会失去a生命值。同时,和第i个弓箭手相邻的弓箭手也会数去b生命值。
As the extreme archers (i.e. archers numbered 1 and n) are very far, the fire ball cannot reach them. Polycarp can hit any other archer with his fire ball.
The amount of health points for each archer is known. An archer will be killed when this amount is less than 0. What is the minimum amount of spells Polycarp can use to kill all the enemies?
Polycarp can throw his fire ball into an archer if the latter is already killed.
由于极端弓箭手的距离非常远(即1和n),火球不能到达他们。Polycarp能够攻击到任何一个火球。
弓箭手的生命值是已知的。弓箭手会被杀死如果生命值小于0.Polycarp可以用来杀死所有敌人的最小法术量是多少?
Polycarp可以将火球扔进弓箭手死去的地方。
输入:
The first line of the input contains three integers n, a, b (3 ≤ n ≤ 10; 1 ≤ b < a ≤ 10). The second line contains a sequence of n integers — h1, h2, ..., hn (1 ≤ hi ≤ 15), where hi is the amount of health points the i-th archer has.
输入的第一行包含三个整数 n, a, b (3 ≤ n ≤ 10;1 ≤ b < a ≤ 10)。第二行包含 n 个整数序列 —h1, h2, ..., hn (1 ≤ 小时我≤ 15),其中h我是第 i 个弓箭手拥有的生命值。
输出:
In the first line print t — the required minimum amount of fire balls.
In the second line print t numbers — indexes of the archers that Polycarp should hit to kill all the archers in t shots. All these numbers should be between 2 and n - 1. Separate numbers with spaces. If there are several solutions, output any of them. Print numbers in any order.
在第一行打印t - 所需的最小量的火球。
在第二行中,打印t编号 - Polycarp应该击中的弓箭手的索引,以杀死t射击中的所有弓箭手。所有这些数字都应介于 2 和 n - 1 之间。用空格分隔数字。如果有多个解决方案,请输出其中任何一个。按任意顺序打印数字。
样例输入:
3 2 1 2 2 2
样例输出:
3 2 2 2
样例输入:
4 3 1 1 4 1 1
样例输出:
4 2 2 3 3