~/algor $ cat problems/dp-ishchilar-va-ishlar
Workers and jobs
Hard
2000 ms
128 MB
86%
There are $n$ workers and $n$ jobs. The $i$-th worker does the $j$-th job for $c_{i,j}$ soums. Each worker must be assigned exactly one job, and each job exactly one worker. What is the smallest total cost?
Input
The first line contains a positive integer $n$. The $i$-th of the next $n$ lines contains $n$ integers: $c_{i,1}, \ldots, c_{i,n}$.
Output
One integer — the smallest total cost.
Note
$1 \le n \le 15$
$0 \le c_{i,j} \le 10^{6}$
Examples
Input #1
3 4 1 3 2 0 5 3 2 2
Output #1
5
Input #2
1 9
Output #2
9