AtCoder Beginner Contest 153 Thank you for your hard work! Official page
The code I wrote this time is here The result was AC from A to D and TLE from F.
I will explain briefly below.
The problem that HP attacks H monsters with attack power A and asks how many times they can be defeated. It should be okay if you pay attention to the processing when the H / A is just divisible.
The problem of adding up the numbers (attack power of the special move) and asking whether it will reach the opponent's HP. You should be able to do a simple addition.
There are N monsters, and you can use special moves K times. You can kill monsters instantly with this special move, so if you are asked who to use this special move, you can add up the physical strength of the remaining enemies.
Of course, I want to use K-body Special Moves in descending order of physical strength, so let's do our best to express it with code.
If you attack once, the monster becomes H / 2 health and splits, and if you have 1 health, you can defeat it. This was relatively simple with ** number of enemies ** and ** enemy health **.
With one operation Add the number of attacks by ** the number of enemies ** Halve the ** enemy's health ** Double the number of ** enemies **
It is OK if you repeat this operation until your physical strength becomes 0.
I don't know, thinking that it seems to be a standard problem of algorithms.
It was a two-line TLE ... My way of thinking ① Sort the coordinates in ascending order ② Convert how many attacks can defeat the enemy's physical strength As a pretreatment,
① Get one coordinate in ascending order ② Get how many more times the enemy at that point can be defeated ③ From there, get points for the range of the bomb ④ Attack the enemies in that range as much as you got in ②.
I think that it will be AC if it can be implemented properly, but I feel that the basic idea is not wrong.
The rating is 956 → 944.
I was able to get to the D problem in 17 minutes, and I felt growth. It seems that the rate will not increase from here unless it can be solved after the E problem. ..
We will review both the E and F questions this time! !! : cry:
Recommended Posts