Question: help Statement You are given three integers N , M , and K . You have K arrows, and your goal is to destroy N
help
Statement
You are given three integers NM and K You have K arrows, and your goal is to destroy N targets. Each
target i has an initial hit points hp value of ai To destroy a target, its hp must be less than or equal to
When you shoot an arrow with power x at target i it decreases the hp of all targets with index ji by an
amount calculated as follows:
Damage to target jmaxMxji
Your task is to find the minimum possible value of x such that you can destroy all targets, given that you can
choose the indices of your arrows optimally.
Input Format
The first line contains three integers NM and K : the number of targets, the multiplier for the arrow
power, and the number of arrows, respectively.
The second line contains N integers aadots,aN representing the initial hp of the targets.
Output Format
Output a single integer, the minimum value of x such that you can destroy all targets.
Constraints
Denote AaadotsaN In all test cases we have
M
Ntimes
K
ai Constraints for each test case:
Sample
K
AMK and N
Atimes MK and N
N
N
Ntimes
Ntimes
Example
Input
Output
Explanation
In the example, you can destroy all targets with the following strategy:
Shoot the first arrow index with power x :
Damage to target :a
Damage to target :a
Damage to target : a
Damage to target :a
Shoot the second arrow index with power x :
Damage to target : a
Damage to target :a
All targets are eliminated.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
