CF6D.Lizards and Basements 2
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
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.
这是原竞赛中题目的简化版本。原题的解法似乎过于困难,因此降低了输入数据的约束条件。
波利卡普喜欢玩一款名为《蜥蜴与地牢》的电脑角色扮演游戏。目前他正以法师的身份进行游戏。在其中某一关的最后阶段,他需要对抗一排弓箭手。他唯一能用来攻击弓箭手的法术是火球术。若波利卡普用火球术击中第 i 个弓箭手(弓箭手从左到右编号),该弓箭手将损失 a 点生命值;同时,该法术还会对第 i 个弓箭手两侧相邻的弓箭手(如果存在)造成伤害——每个相邻弓箭手各损失 b 点生命值(其中 1≤b<a≤10)。
由于最左侧和最右侧的弓箭手(即编号为 1 和 n 的弓箭手)距离过远,火球术无法击中他们。波利卡普只能用火球术攻击其余任意一个弓箭手。
每个弓箭手的初始生命值均已知。当弓箭手的生命值严格小于 0 时,该弓箭手即被击杀。问:波利卡普至少需要使用多少次火球术,才能击杀所有敌人?
即使某个弓箭手已被击杀,波利卡普仍可向其位置施放火球术。
输入格式
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 — _h_1, _h_2, ..., h__n (1 ≤ h__i ≤ 15), where h__i 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 ≤ hi ≤ 15),其中 hi 表示第 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 之间(含端点)。数字之间用空格分隔。若存在多种解,输出任意一种即可。数字的输出顺序不限。
输入输出样例
输入#1
3 2 1 2 2 2
输出#1
3 2 2 2
输入#2
4 3 1 1 4 1 1
输出#2
4 2 2 3 3
输入解题思路,AI测评打分。不知道怎么写?