| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 | 2048 MB | 0 | 0 | 0 | 0.000% |
You are shopping from a store that sells a total of $M$ items. The store layout can be modelled as a two-dimensional plane, where the $i$-th item is located at the point $(x_i , y_i)$ and has a price of $p_i$.
The store offers $N$ shopping deals. The $i$-th shopping deal is specified by a point $(a_i , b_i),ドル and for a cost of $c_i,ドル you can obtain one of every item within exactly one of the following four regions of your choice:
Each shopping deal can only be used at most once. Items can also be purchased individually by paying their respective price $p_i$.
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 $N$ and $M$.
The next N lines of input each contain three space-separated integers, $a_i,ドル $b_i,ドル and $c_i$ ($−10^9 ≤ a_i , b_i ≤ 10^9,ドル 1ドル ≤ c_i ≤ 10^9$).
The next M lines of input each contain three space-separated integers, $x_i$ , $y_i$ , and $p_i$ ($−10^9 ≤ x_i , y_i ≤ 10^9,ドル 1ドル ≤ p_i ≤ 10^9$).
On a single line, output the minimum total cost that you must pay to obtain at least one of each item.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 1 | 1ドル ≤ N ≤ 8,ドル 1ドル ≤ M ≤ 20$ |
| 2 | 3 | 1ドル ≤ N ≤ 70,ドル 1ドル ≤ M ≤ 20$ |
| 3 | 3 | 1ドル ≤ N ≤ 70,ドル 1ドル ≤ M ≤ 70$ |
| 4 | 4 | 1ドル ≤ N ≤ 100,ドル 1ドル ≤ M ≤ 100,円 000$ No two points $(a_i , b_i)$ or $(x_j , y_j )$ have the same $x$ or $y$-coordinate. |
| 5 | 2 | 1ドル ≤ N ≤ 100,ドル 1ドル ≤ M ≤ 100,円 000$ |
| 6 | 8 | 1ドル ≤ N ≤ 1,円 000,ドル 1ドル ≤ M ≤ 100,円 000$ No two points $(a_i , b_i)$ or $(x_j , y_j )$ have the same $x$ or $y$-coordinate. |
| 7 | 4 | 1ドル ≤ N ≤ 1,円 000,ドル 1ドル ≤ M ≤ 100,円 000$ |
2 4 1 1 3 3 3 13 0 0 2 0 2 5 2 0 4 2 2 3
12
Use the first shopping deal on the region $\{(x, y) | x ≤ 1, y ≥ 1\}$ to obtain the second item. Then, purchase items 1ドル,ドル 3ドル,ドル and 4ドル$ individually. The total cost is 3ドル + (2 + 4 + 3) = 12$.