#P12971. [CCO 2025] Shopping Deals
[CCO 2025] Shopping Deals
题目描述
You are shopping from a store that sells a total of items. The store layout can be modelled as a two-dimensional plane, where the -th item is located at the point and has a price of .
The store offers shopping deals. The -th shopping deal is specified by a point , and for a cost of , you can obtain one of every item within exactly one of the following four regions of your choice:
- The region of points such that and .
- The region of points such that and .
- The region of points such that and .
- The region of points such that and .
Each shopping deal can only be used at most once. Items can also be purchased individually by paying their respective price .
You want to obtain at least one of each item in the store. Find the minimum total cost you must pay to do so.
输入格式
The first line of input contains two space-separated integers and .
The next lines of input each contain three space-separated integers, , , and (, ).
The next lines of input each contain three space-separated integers, , , and (, ).
输出格式
On a single line, output the minimum total cost that you must pay to obtain at least one of each item.
2 4
1 1 3
3 3 13
0 0 2
0 2 5
2 0 4
2 2 3
12
提示
Sample 1 Explanation
Use the first shopping deal on the region to obtain the second item. Then, purchase items 1, 3, and 4 individually. The total cost is .
The following table shows how the available marks are distributed:
Marks Awarded | Bounds on | Bounds on | Additional Constraints |
---|---|---|---|
1 mark | None | ||
3 marks | |||
4 marks | No two points or have the same or -coordinate. | ||
2 marks | None | ||
8 marks | No two points or have the same or -coordinate. | ||
4 marks | None |