Score : $600$ points
We have a bipartite graph with $L$ vertices to the left and $R$ vertices to the right.
Takahashi will install surveillance cameras in these vertices.
Installing cameras incurs the following cost.
It is allowed to install multiple cameras on the same vertex.
Find the minimum amount of money needed to install cameras to satisfy the following condition.
Input is given from Standard Input in the following format:
$L$ $R$ $A_1$ $A_2$ $\dots$ $A_L$ $B_1$ $B_2$ $\dots$ $B_R$ $C_{1,1}$ $C_{1,2}$ $\dots$ $C_{1,R}$ $C_{2,1}$ $C_{2,2}$ $\dots$ $C_{2,R}$ $\vdots$ $C_{L,1}$ $C_{L,2}$ $\dots$ $C_{L,R}$
Print the answer as an integer.
3 4 4 3 6 5 2 3 4 1 2 3 2 2 1 2 3 3 2 1 2
37
You can achieve the objective for $37$ yen as follows, which is the minimum amount required.
1 1 10 10 0
0
No camera may be needed.
5 6 3 2 6 7 5 4 9 8 6 2 3 2 0 2 1 1 0 2 3 2 1 0 0 2 2 4 0 2 2 4 1 0 3 0 2 1 0 0 2 2 5
79