#P10769. 「CROI · R2」公交接驳
「CROI · R2」公交接驳
Description
To handle peak-hour crowds, the bus company will deploy buses along a route with transfer stations (numbered 1 to west-to-east). Each transfer station has a priority value . The travel time from station to is (ignoring stop time). The railway arrives at station at time . Bus travel time between stations is always ≥ railway travel time.
You must schedule buses such that:
- All passengers arriving at any station at can board a bus (bus arrival time ≥ ).
- For each station , the dissatisfaction is calculated as:
(waiting time for the first bus) × (priority of the bus's origin station).
If multiple buses arrive simultaneously, passengers choose the one with the smallest .
Minimize the total dissatisfaction across all stations for multiple queries with different and .
Input Format
First line: Integer (number of stations).
Second line: integers (travel times).
Third line: integers (priorities).
Fourth line: Integer (number of railway schedules).
For each schedule:
- Line 1: integers (railway arrival times).
- Line 2: Integer (number of queries).
- Line 3: integers (bus counts to test).
Output Format
For each schedule, output integers—the minimal total dissatisfaction for each .
3
3 4
6 2 1
2
1 3 7
2
1 2
2 3 5
3
1 2 4
12 0
36 4 0
6
2 2 2 2 3
13 12 15 9 3 1
3
5 7 9 11 12 13
4
1 2 4 8
3 4 5 7 8 10
3
2 4 5
1000000 1000001 1000002 1000003 1000004 1000005
2
1 3
52 6 0 0
49 3 0
208 31
Hint
【Data Range】
Constraints:
- ,
- , ,
Subtasks:
| Subtask | | | | | Special | Points |
|---------|-----|-----|-------|------------|---------|--------|
| 1 | 15 | 1e3 | 1e3 | 15 | None | 5 |
| 2 | 15 | 1e6 | 1e6 | 1e6 | None | 5 |
| 3 | 100 | 1e6 | 1e6 | 1e6 | None | 15 |
| 4 | 1e3 | 1e6 | 1e6 | 1e6 | A | 5 |
| 5 | 1e3 | 1e6 | 1e6 | 1e6 | B | 30 |
| 6 | 1e3 | 1e3 | 1.1e3 | 1e3 | None | 10 |
| 7 | 1e3 | 1e6 | 1e6 | 1e6 | None | 30 |
- Special A:
- Special B:
【Sample Explanation】
Below are feasible optimal bus scheduling plans for the sample queries. Note that there may be multiple valid optimal solutions.
For the first schedule in Sample 1:
-
When :
A bus departs station 1 at time . Operational details:
| | Station 1 | Station 2 | Station 3 |
| :-------------------: | :-------: | :-------: | :-------: |
| Railway Arrival Time | | | |
| Bus Service 1 Arrival | | | |
| Boarded Service | Service 1 | Service 1 | Service 1 |
| Waiting Time | | | |Service 1 starts at station 1 (). Total dissatisfaction:
-
When :
Buses depart station 1 at and station 2 at . Operational details:
| | Station 1 | Station 2 | Station 3 |
| :-------------------: | :-------: | :-------: | :-------: |
| Railway Arrival Time | | | |
| Bus Service 1 Arrival | | | |
| Bus Service 2 Arrival | — | | |
| Boarded Service | Service 1 | Service 2 | Service 2 |
| Waiting Time | | | |Service 1 starts at station 1 (), Service 2 at station 2 (). Total dissatisfaction:
For the second schedule in Sample 1:
-
When :
A bus departs station 1 at . Operational details:
| | Station 1 | Station 2 | Station 3 |
| :-------------------: | :-------: | :-------: | :-------: |
| Railway Arrival Time | | | |
| Bus Service 1 Arrival | | | |
| Boarded Service | Service 1 | Service 1 | Service 1 |
| Waiting Time | | | |Total dissatisfaction:
-
When :
Buses depart station 1 at and station 2 at . Operational details:
| | Station 1 | Station 2 | Station 3 |
| :-------------------: | :-------: | :-------: | :-------: |
| Railway Arrival Time | | | |
| Bus Service 1 Arrival | | | |
| Bus Service 2 Arrival | — | | |
| Boarded Service | Service 1 | Service 2 | Service 2 |
| Waiting Time | | | |Total dissatisfaction:
-
When :
Buses depart:- Station 1 at and .
- Station 2 at and .
Operational details:
Station 1 Station 2 Station 3 Railway Arrival Time Bus Service 1 Arrival Bus Service 2 Arrival Bus Service 3 Arrival - Bus Service 4 Arrival Boarded Service Service 2 Service 4 Service 3 Waiting Time Services 1/2 start at station 1 (), Services 3/4 at station 2 (). Total dissatisfaction:
Note: At Station 3, Services 1 and 3 arrive simultaneously at . Passengers choose Service 3 (lower ) over Service 1 ().
京公网安备 11011102002149号