#P2198. 杀蚂蚁
杀蚂蚁
Description
After Little FF’s research, he found that the ants always attack along the same route of length units, and the time needed to traverse one unit length is seconds. In other words, as long as Little FF deploys defenses along this route and inflicts heavy damage on the ants, he can stop their advance.
SCV specializes in building three kinds of defense towers: Laser Tower, Radiation Tower, and Interference Tower. On each unit length, exactly one tower can be built. Their effects are as follows:
Laser Tower: Uses high-energy lasers and deals damage per second to the ants while they pass in front of the tower.
Radiation Tower: Releases radioactive elements. After the ants pass this tower, they take damage per second.
Interference Tower: Disrupts the ants’ pheromones. After the ants pass this tower, the time to traverse each subsequent unit length becomes .
The effects of Radiation Towers and Interference Towers stack. That is, if the enemy has passed Radiation Towers, then they take damage per second; similarly, if they have passed Interference Towers, then the time to traverse one unit length becomes .
There is enough time before the next wave of attacks. As the chief engineer of the “NewBe_One” project, now appointed as the chief strategist, you must design a tower placement plan that maximizes the total damage dealt to the ants.
Input Format
The input contains a single line with integers separated by a space. They represent: the total route length you can deploy on , the Laser Tower’s per-second damage , the Radiation Tower’s per-second damage , the Interference Tower’s per-unit time increase , and the base time per unit length .
Output Format
Output a single integer, the maximum total damage your plan can deal to the enemy.
5 4 3 2 1
82
Hint
Sample Explanation
At position build a Radiation Tower; at positions and build Interference Towers; at positions and build Laser Towers.
Constraints
For of the testdata: .
For of the testdata: $1 \leq n \leq 1024, 0 \leq r,g,b \leq 65536, 0 \leq T \leq 3$.
For the remaining of the testdata: $1 \leq n \leq 400, 0 \leq r,g,b \leq 2^{31}-1, 0 \leq T \leq 1000$.
Translated by ChatGPT 5
京公网安备 11011102002149号