Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Clash Of Clans - Problem Description In Clash of Clans, you as a village chief is gearing up for a raid on an enemy village.
Clash Of Clans
Problem Description
In Clash of Clans, you as a village chief is gearing up for a raid on an enemy village. The success of this mission depends on assembling the most potent raiding army by selecting troops from various categories. Each troop type has distinct strengths and weaknesses, and your goal is to create a formidable army that maximizes overall damage. To build an army you first need to train them in the "Barracks" which has some capacity B Each troop has some size S it occupies in the barrack that trains and increases some amount of damage per second D for each troop.
There are various troops for eg Barbarian, Archer, Giant, Goblin and so on which belong to some category C for eg Elixir Troop, Temporary Troop, Super Troops and so on
To train them you decided to have a versatile army where you select at most one or no troops from each category of the troops such that it has maximum damage per second and the troops fit within the barrack size for training.
Constraints
Length of S D C
length of S D
Number of categories
I B Sumofs
Size of the troop Size of the Barrack e Si B
Input
The first line contains the list of integers denoting damage per second capability D of the troop
The second line contains the list of integers denoting the size S of the troop.
The third line contains a list of integers denoting the category C of the troop.
Last line contains an integer denoting the size of the barrack.
Output
Print the maximum damage per second that can be achieved.
Time Limit secs
Examples
Example :
Input:
Output:
Explanation
The goal is to maximize the damage per second where you select at most one or none from each category. So here we choose the st troop which belongs to category nd troop which belongs to category and th troop which belongs to category whose total size is which is within the barrack size. We could not accommodate any troop from category because the damage per second capability reduces or the barrack capacity falls short. Hence, the total damage per second is
Example :
Input
Output:
Explanation
Here we choose the st troop which belongs to category th troop which belongs to category and th troop which belongs to category whose total size is which is within the barrack size. We could not accommodate any troop from category because the damage per second capability reduces or the barrack capacity falls short. Hence, the total damage per second is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started