## Attack of the Bloons

View as PDF

Points: 10
Time limit: 2.5s
Memory limit: 64M

Author:
Problem type
##### University of Toronto ACM-ICPC Tryouts 2012

The Bloons (not to be confused with balloons) are attacking! They are attempting to navigate your course of cells, laid out in a row and numbered from to . You don't know what they'll do to you if they manage reach the end, and you don't want to find out! To that end, you've constructed some defensive towers along the course. You might say that this is a Bloons Tower Defense.

There are towers ready to take out any Bloons that get close. The -th tower is located next to cell , and can launch darts at any Bloons that are no more than cells away - that is, Bloons in cells to , inclusive. Every second, it will do HP worth of damage to any Bloons in this range.

Bloons will attempt to float through your course, one after another. The -th Bloon begins with HP, and will pop as soon as it has taken at least that much damage in total. Each Bloon starts in cell 1, and moves along the course at a speed of 1 cell per second. If a Bloon moves past cell , it safely exits the course and can no longer be popped.

There are scenarios as described above. For each, you'd like to determine how far along the course each of the Bloons will make it.

#### Input Specification

Line 1: 1 integer,
For each scenario:
Line 1: 2 integers, and
Next lines: 3 integers, , , and , for
Next line: 1 integer,
Next lines: 1 integer, , for

#### Output Specification

For each scenario:
lines: If the -th Bloon will survive the course, the string "Bloon leakage" (without quotes) - otherwise, 1 integer, the furthest cell which the -th Bloon will reach, for

1
10 3
3 3 1
4 0 4
10 2 2
4
1
20
9
11

1
Bloon leakage
5
8

#### Explanation of Sample

The following diagram illustrates which cells each tower can hit:

The first Bloon, having only 1 HP, will go down to the first tower in cell 1.
The second Bloon will manage to clear the course, surviving past cell 10 with 4 HP remaining.
The third Bloon will lose its final HP while at cell 5, having taken 5 damage from the first tower, and 4 from the second.
The final Bloon will survive past cell 6 with 1 HP remaining, but will then go down at cell 8 when it takes 2 damage from the third tower.

## Comments

There are no comments at the moment.