LCC '23 Contest 2 J2 - Knives

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

After entering the portal, Macduff is brought to a spooky corridor, with a portal on the other end of the room. Macbeth is standing at the other end of the corridor, laughing:

Is that a dagger I see before me?

Suddenly daggers appear in a line, filling the corridor. Macbeth enters the portal on the other end of the room.

Macduff needs to chase after Macbeth. He knows that the dagger does damage, and that he needs to get through all daggers to reach the portal. He knows that he currently has health. If his health goes to , he will die.

Luckily, Macduff has health potions, the of which will increase his health by . He can only use one potion. Macduff wants to know how many of the health potions he has will allow him to make it to the other end of the room. Can you help?

Input Specification

The first line will contain integers , , and .

The second line will contain integers, .

The third and final line will contain integers, .

Output Specification

Output the number of health potions Macduff has that will allow him to make it to the other end of the room.

Sample Input

5 3 5
1 2 3 4 5
5 10 11

Sample Output

1

Sample Explanation

Only the third health potion will allow him to go through the knives without reaching a health of less than or equal to .