cswork / OA打开练习工作台

AmazonOA #322

Package Delivery System

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)贪心调度单调栈与堆

Each shipment scenario has a list of truck capacities and a list of pa

Constraints

The number of scenarios and the lengths of the nested arrays can be large, so the solution should avoid brute-force backtracking over all assignments.

Example 1

Input:

truckCapacities = [[7]]
packageWeights = [[4, 3]]

Output:

[1]

Explanation: The single truck delivers package 4, its capacity drops to 3, and it can still deliver package 3. The scenario is feasible.