← 返回 amazon 的题目列表Minimal Cost of Buying Servers
类型:online_judge
Amazon sells servers, each with an associated cost and efficiency. Given two lists:
cost[i] represents the cost of the i-th server.
efficiency[i] represents the efficiency of the i-th server.
The goal is to purchase a subset of servers such that:
The total efficiency meets or exceeds a given threshold k.
The total cost is minimized.
Each server can be purchased only once.
Return the minimum total cost required to achieve the efficiency target k. If it's impossible to reach k, return -1.
Example
Input
3 5
1 2 3
4 3 5