#P4452. [国家集训队] 航班安排
[国家集训队] 航班安排
Description
Shenniu Airlines has airplanes. To simplify the problem, assume all airplanes are identical. In the world of Shenniu Airlines, there are airports, numbered , where airport is the base. All airplanes are at airport at time , may take off starting from time , and must return to airport no later than time .
During one day, the company receives charter requests. Each request is: depart from airport at time , arrive at airport exactly at time , and earn a net profit of . In other words, if you assign an airplane at time at airport to this request, that airplane will appear at airport at time , and you will gain a net profit of .
Design a plan to maximize the total profit.
Input Format
- The first line contains positive integers , as described above.
- The next lines each contain integers, describing an matrix , where is the time needed to ferry (empty flight) from airport to airport .
- The next lines each contain integers, describing an matrix , where is the cost to ferry from airport to airport .
- The next lines each describe one request with integers: .
Output Format
Output a single line with one integer: the maximum profit.
2 1 1 10
0 5
5 0
0 5
5 0
0 1 0 5 10
5
Hint
- For of the testdata, .
- For another of the testdata, .
- For all the testdata: , , , , , , , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号