Mighty Cactus

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 256M

Problem types

hiddencactus has some amazing super powers! One day, he was in the desert, fighting off bad guys. The battle got very serious, and he needs your help to win the battle!

hiddencactus has K different sets of plant armor, and each of the armor has 3 sets of properties.

  • ti, the toughness of the armor, which reduces the incoming damage by ti.
  • ai, the shock absorption of the armor, which reduces the remaining damage by ai%.
  • At any given time, at most one plant armor can be used, and plant armors can be reused.

There are M enemies and they all have a set duration of attack, for each enemy:

  • They have a start time si, representing the start time of the attack in seconds.
  • They have a duration of attack, which is li, which means the enemies damage hiddencactus up to the si+li1 second, starting from the sith second.
  • They have an attack damage, xi, meaning enemies do xi points of damage every second that they are attacking.

hiddencactus starts with N health points, meaning that he can take up to N points of attack damage.

hiddencactus is concentrating on the battle, and is confused on the optimal usage of his armor, can you help him? You are to help him find the maximum amount of health points he has left, if he uses his plant armors optimally.

Input Specification

The first line contains the 3 integers N (1N109), M (0M105), K (0K5), denoting the number of health points, enemies, and armor sets respectively.

The next K lines each contain two integers, ti (0ti2×106) and ai (0ai100).

The next M lines each contain three integers, si (0si105), li (1li105) and xi (1xi100).

Output Specification

The maximum amount of health points hiddencactus can have remaining, rounded to two decimal places.

If hiddencactus cannot sustain all the damage, you are to output Act Like A Cactus..

Sample Input 1

Copy
100 2 2
0 50
10 0
0 10 11
5 1 50

Sample Output 1

Copy
60.50

Explanation for Sample Output 1

hiddencactus should use plant armor #1 during the fifth second.

During all other times, he should use plant armor #2 to block more of the incoming damage.

Sample Input 2

Copy
10 1 1
10 50
3 1 50

Sample Output 2

Copy
Act Like A Cactus.

Comments

There are no comments at the moment.