|
You have many people working for you, and you have an urgent job that needs to be done immediately. You know each worker's skill level at performing the task, and you also know that groups often work better than individuals. This particular task requires everybody in a group to perform at the same pace. Therefore, a group of talented people can easily be slowed down by having a single less talented member.
You have established that the productivity of a group is K*X, where K is the number of people in the group and X is the minimum skill level in the group. You must assemble a group with the highest possible productivity. You will be given two int[]s p and s describing the people who work for you. Each element of p represents a set of workers who all have the same skill level. The ith element of p is the number of people in the ith set, and the ith element of s is the skill level of each worker in the ith set. The input is organized into sets only for convenience. You are free to choose any number of individuals from any number of sets when assembling your group. See examples for further clarification. Return the highest achievable productivity.
|
| {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} | {31,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} |
| Returns: 31 | The skilled worker has higher productivity working alone than any other group of workers. |
|
|