Description
You are working in the SPD – Sofia Police Department. Currently the SPD is suffering from lack of resources, so you need to do more work. Your job is to patrol while keeping your car in the best condition possible. Of course, it’s more rewarding to catch Pokémon’s, so that’s what you do. You are given a car with limited amount of fuel. You will be given the possible streets to patrol for the shift and information about each street. It will contain the length of the street, the count of Pokémon’s on it and the damage it will deal to your car. 1 unit of length costs 1 fuel. The car damage is important, because you don’t want to destroy your car for a single Pokémon.
How to make your decisions? This will be your formula. Multiply the count of Pokémon’s by 10 and subtract the car damage. Example:
Street Info – Length 4, 4 Pokémon’s, 6 car damage -> The value of the Pokémon’s is 40. Subtract the car damage and you get 34. This will be the value you want to maximize based on the fuel you have. If you receive a street with negative value, ignore it.
Your report must contain the following information
• All streets that you are going to patrol in the order of receiving them
• Total Pokémon’s caught
• Total car damage dealt
• The remaining fuel after the shift
Input
• The first line holds an integer f – the remaining fuel in the car
• On the next lines, you will receive the streets in the format below, until receiving the “End” command
o {street name}, {car damage}, {pokemon count}, {length}
Output
• On the first line, you need to print all streets that you will check in order of appearance
o {street name} -> {street name} -> …
• On the second line, you need to print the Pokémon count o “Total Pokémon’s caught -> {count}”
• On the third line, print the car damage o “Total car damage -> {damage}”
• On the last line, you need to print the remaining fuel
o “Fuel left -> {fuel}”
Constraints
• The fuel – f will be an integer in the range [0…1000]
• The number of streets will be an integer in the range [0…1000]
• The street length will be an integer in the range [0…1000]
• The Pokémon count per street will be an integer in the range [0…100]
• The car damage per street will be an integer in the range [0…1000]
• Time limit: 100 ms. Allowed memory: 16 MB
Examples
Input Output
4
Street 1, 10, 4, 1
Street 2, 50, 8, 3
Street 3, 0, 2, 2
Street 4, 70, 5, 4
End Street 1 -> Street 2
Total pokemons caught -> 12
Total car damage -> 60
Fuel Left -> 0
10
Tintiava, 50, 10, 3
Nikolai Haitov, 10, 4, 3
Samokov, 10, 6, 5
Jetvarka, 0, 1, 2
132, 40, 4, 3
End Tintiava -> Samokov -> Jetvarka
Total pokemons caught -> 17
Total car damage -> 60
Fuel Left -> 0
5
Tintiava, 4, 1, 2
Nikolai Haitov, 3, 3, 3
Samokov, 3, 2, 3
132, 10, 3, 1
End Nikolai Haitov -> 132
Total pokemons caught -> 6
Total car damage -> 13
Fuel Left -> 1
10
DoNotPickMe, 50, 1, 5
End
Total pokemons caught -> 0
Total car damage -> 0
Fuel Left -> 10
Reviews
There are no reviews yet.