#P16229. [蓝桥杯 2026 省 A] 外卖配送
[蓝桥杯 2026 省 A] 外卖配送
Problem Description
In the lunchtime rush at a food delivery station, courier Xiao Lan is staring at the screen showing pending orders. These orders must be delivered strictly in the fixed order listed by the system; they cannot be rearranged or skipped. To complete the task smoothly, Xiao Lan plans to split the orders into several batches for delivery.
There are different types of vehicles at the station. Each vehicle has two attributes: average travel time and box crowding coefficient . For each batch, Xiao Lan may independently choose the most suitable vehicle from the types based on the number of orders in that batch.
Suppose a batch contains orders, and Xiao Lan chooses vehicle type . Then the total time for this batch consists of the following three parts:
- Travel time: seconds.
- Pickup/packing time: due to squeezing in the box, arranging orders requires handling pairs of squeezing relationships. Each pair takes seconds, for a total of seconds.
- Return time: delivering in batches incurs extra return cost. When processing the first batch, since Xiao Lan is assumed to have already loaded at the station and can depart directly, this part takes seconds. Starting from the second batch, each time a new batch is started, a fixed seconds must be spent to return to the station to load the next batch.
Now, please help Xiao Lan plan an optimal batching scheme and compute the minimum total time needed to finish delivering all orders.
Input Format
The first line contains three integers , , and , representing the total number of orders, the number of vehicle types, and the fixed time cost.
The next lines each contain two integers and , representing the average travel time and the box crowding coefficient of the -th vehicle type.
Output Format
Output one integer, the minimum total time required to complete delivery of all orders (in seconds).
5 2 40
10 8
2 20
118
Hint
Sample Explanation
One optimal plan is to split into batches:
| Stage | Details | Time |
|---|---|---|
| Batch ( orders, choose vehicle ) | Travel ; Pickup/packing | seconds |
| Return | Fixed time cost | seconds |
| Batch ( orders, choose vehicle ) | Travel ; Pickup/packing | seconds |
| Total | seconds |
Constraints
For of the testdata, .
For all testdata, , .
Translated by ChatGPT 5