← 返回 doordash 的题目列表Driver Pay With In-Store Waiting (ARRIVED/PICKED_UP is exclusive)
类型:online_judge
Problem: Add In-Store Waiting (ARRIVED/PICKED_UP is exclusive)
Extend the previous problem with the status chain:
ACCEPTED -> ARRIVED -> PICKED_UP -> DELIVERED
Pay rules:
ACCEPTED to ARRIVED: stackable (counts toward concurrency).
ARRIVED to PICKED_UP: in-store waiting; non-stackable.
For any minute covered by at least one waiting interval, pay for that minute is capped to 1 * rate (no multiplication by the number of concurrent orders).
PICKED_UP to DELIVERED: stackable.
Compute the total pay.
Input (suggested)
n rate then n lines of order_id timestamp status.
Output
Total pay.
Example
Input
8 5
A 0 ACCEPTED
A 2 ARRIVED
A 6 PICKED_UP
A 10 DELIVERED
B 1 ACCEPTED
B 3 ARRIVED
B 4 PICKED_UP
B 7 DELIVERED
Output
60