{"problem":{"name":"Security Camera 2","description":{"content":"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. ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc224_h"},"statements":[{"statement_type":"Markdown","content":"We have a bipartite graph with $L$ vertices to the left and $R$ vertices to the right.  \nTakahashi will install surveillance cameras in these vertices.  \nInstalling cameras incurs the following cost.\n\n*   $A_i$ yen (the Japanese currency) for each camera installed in the $i$\\-th $(1 \\le i \\le L)$ vertex to the left;\n*   $B_j$ yen (the Japanese currency) for each camera installed in the $j$\\-th $(1 \\le j \\le R)$ vertex to the right.\n\nIt is allowed to install multiple cameras on the same vertex.\nFind the minimum amount of money needed to install cameras to satisfy the following condition.\n\n*   For every pair of integers $(i, j)$ such that $1 \\le i \\le L, 1 \\le j \\le R$, there is a total of $C_{i,j}$ or more cameras installed in the $i$\\-th vertex to the left and $j$\\-th vertex to the right.\n\n## Constraints\n\n*   All values in input are integers.\n*   $1 \\le L,R \\le 100$\n*   $1 \\le A_i,B_i \\le 10$\n*   $0 \\le C_{i,j} \\le 100$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$L$ $R$\n$A_1$ $A_2$ $\\dots$ $A_L$\n$B_1$ $B_2$ $\\dots$ $B_R$\n$C_{1,1}$ $C_{1,2}$ $\\dots$ $C_{1,R}$\n$C_{2,1}$ $C_{2,2}$ $\\dots$ $C_{2,R}$\n$\\vdots$\n$C_{L,1}$ $C_{L,2}$ $\\dots$ $C_{L,R}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc224_h","tags":[],"sample_group":[["3 4\n4 3 6\n5 2 3 4\n1 2 3 2\n2 1 2 3\n3 2 1 2","37\n\nYou can achieve the objective for $37$ yen as follows, which is the minimum amount required.\n\n*   Install $2$ cameras on the $1$\\-st vertex in the left.\n*   Install $3$ cameras on the $2$\\-nd vertex in the left.\n*   Install $2$ cameras on the $3$\\-rd vertex in the left.\n*   Install $1$ camera on the $1$\\-st vertex in the right.\n*   Install $1$ camera on the $3$\\-rd vertex in the right."],["1 1\n10\n10\n0","0\n\nNo camera may be needed."],["5 6\n3 2 6 7 5\n4 9 8 6 2 3\n2 0 2 1 1 0\n2 3 2 1 0 0\n2 2 4 0 2 2\n4 1 0 3 0 2\n1 0 0 2 2 5","79"]],"created_at":"2026-03-03 11:01:13"}}