02.14 Lizards and Basements 2

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‎, ‎‎h‎2‎, ..., ‎‎h‎n (‎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 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值