#P11217. 【MX-S4-T1】「yyOI R2」youyou 的垃圾桶
【MX-S4-T1】「yyOI R2」youyou 的垃圾桶
Background
Original link: https://oier.team/problems/S4A。
Problem Description
There are trash cans, and they attack youyou. The initial attack power of the -th trash can is a positive integer . youyou's initial health is a positive integer .
Define the following process as one battle:
- Starting from trash can , each trash can attacks in order. When the -th trash can attacks, youyou's health decreases by , and then in this battle the -th trash can's attack power doubles. After the -th trash can finishes its attack, repeat this process.
When , i.e. when youyou dies, this battle ends immediately. Then reset youyou's health and all trash cans' attack power to the values before this battle.
The score of this battle is defined as the number of times youyou is attacked by trash cans (not including the attack that kills youyou exactly).
Now there are battles in total. For each battle, three numbers are given, meaning that you first strengthen the trash cans in , increasing their initial attack power by , and then run a battle. You need to tell youyou the score of this battle.
The increases to the trash cans' initial attack power before each battle will affect all subsequent battles.
Input Format
The first line contains three integers , representing the number of trash cans, the number of battles, and the health.
The second line contains integers. The -th number represents the attack power of the -th trash can before all battles.
The next lines each contain three integers , representing the strengthening parameters before the -th battle.
Output Format
Output lines in total. The -th line outputs one number , representing the score of the -th battle.
6 4 75
9 1 4 5 1 4
1 1 1
3 5 3
3 5 1
3 5 3
11
9
8
8
Hint
Sample Explanation #1
The strengthenings before the four battles are:
- Increase the attack power of trash cans in by .
- Increase the attack power of trash cans in by .
- Increase the attack power of trash cans in by .
- Increase the attack power of trash cans in by .
In the first battle, the initial attack powers of the trash cans are .
youyou is first attacked once by each of these trash cans in order, and the remaining health is . The trash cans' attack power becomes .
Next, youyou is attacked by the first trash can, and the remaining health is .
After being attacked by the second trash can, the remaining health is .
After being attacked by the third trash can, the remaining health is .
And so on. When attacked by the sixth trash can, the remaining health becomes . Since the lethal attack is not counted, youyou received a total of attacks.
In the second battle, the initial attack powers of the trash cans are .
In the third battle, the initial attack powers of the trash cans are .
In the fourth battle, the initial attack powers of the trash cans are .
It can be concluded that the scores of battles are , respectively.
Sample #2
See the attached wxyt/wxyt2.in and wxyt/wxyt2.ans.
This sample satisfies the constraints of test points .
Sample #3
See the attached wxyt/wxyt3.in and wxyt/wxyt3.ans.
This sample satisfies the constraints of test points .
Sample #4
See the attached wxyt/wxyt4.in and wxyt/wxyt4.ans.
This sample satisfies the constraints of test points .
Constraints
This problem has test points, each worth points.
| Test Point ID | ||
|---|---|---|
For all data, it is guaranteed that , , , , , 。
Translated by ChatGPT 5