Travelling Salesman Problem - MarisaOJ: Marisa Online Judge

Travelling Salesman Problem

Time limit: 1000 ms
Memory limit: 256 MB
There are $n$ cities. Going from city $i$ to city $j$ cost $A_{i, j}$ coins. Find the minimum cost route that visits each city exactly once and returns to the starting city. ### Input - The first line contains integers $n$. - Next $n$ lines, $i^{th}$ line contains $n$ integers $A_{i, j}$. ### Output - A single integers is the minimum cost. ### Constraints - $1 \le n \le 10$ - $1 \le A_{i, j} \le 1000$ ### Example Input: ``` 5 0 2 8 5 1 10 0 5 9 9 3 5 0 6 6 2 8 2 0 2 6 3 8 7 0 ``` Output: ``` 17 ```