← 返回 roblox 的题目列表Phone Battery Discharge Scheduling
类型:qbank
Schedule or select phone activities under battery discharge constraints to maximize usable time or completed work.
Examples
Example 1:
Input: t = 10 capacity = [3,4,2] recharge = [5,6,8]
Output: [0,1,2]
Explanation:
Battery 0 runs from real-time 0 to 3 (full discharge), battery 1 from 3 to 7 (full discharge), battery 2 from 7 to 9 (full discharge). At real-time 9, battery 0 is back (recharged at 8) and runs for 1 more minute before the phone hits 10 minutes of usage — partial use, not counted.
Example 2:
Input: t = 10 capacity = [5] recharge = [5]
Output: [0,0]
Explanation:
Battery 0 runs 0..5 (full discharge, ready again at 10). Phone is off from real-time 5 to 10. At real-time 10, battery 0 runs another 5 minutes (full discharge), bringing usage to 10.
Example 3:
Input: t = 4 capacity = [5] recharge = [10]
Output: []
Explanation:
Battery 0 provides 5 minutes of capacity but only 4 are used before the phone hits the runtime target — partial use, never fully discharged.
Constraints
1 <= t <= 10^4
1 <= capacity.length == recharge.length <= 10^3
1 <= capacity[i] <= 10^4
0 <= recharge[i] <= 10^4