#P9784. [ROIR 2020] 超速 (Day1)
[ROIR 2020] 超速 (Day1)
Description
Translated from ROIR 2020 Day1 T2. Превышение скорости, translated by ShineEternal.
Speeding is a dangerous illegal behavior that greatly increases the chance that traffic accidents lead to tragic consequences. Unfortunately, controlling speed using radar and cameras cannot completely solve the problem. To prevent this behavior, one can limit speeding by imposing fines based on the time a car spends on a section of road.
Now there are road segments numbered from to . Segment has length meters, and its speed limit is meters per second. Speeding will be fined, but to reflect “pay according to work”, different levels of speeding have different fine amounts.
Specifically, if the car does not speed, then there is no fine. Otherwise, let be the value of the car’s maximum speed on this segment minus the speed limit:
- If , the penalty is units of currency.
- If , the penalty is units of currency.
- ...
- If , the penalty is units of currency.
- If , the penalty is units of currency.
Currently, there are cars that will pass through these road segments. Each car arrives at segment at time , and leaves segment at time .
You need to compute, for each car, the minimum possible value of the highest fine amount it is charged among all segments.
Time is measured starting from when the road opens, i.e. starting from .
Input Format
The first line contains a positive integer , the number of road segments.
The next two lines each contain numbers: the first line is , and the second line is .
The fourth line contains a positive integer , the number of the different fine ranges.
The next two lines: the first line contains numbers, which are ; the second line contains numbers, which are .
The seventh line contains a positive integer , the number of cars.
The next lines each contain two integers .
Output Format
Output lines in total.
For each car, output the minimum fine amount it must be charged.
3
10 20 30
400 500 600
6
1 5 10 12 16
100 300 600 800 1000 1500
3
10 100
20 70
45 100
0
800
600
Hint
For of the testdata, , , , , .
| Task ID | Special Constraints | Score |
|---|---|---|
| No special constraints |
Translated by ChatGPT 5
京公网安备 11011102002149号