report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
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$ - $A_{i,i}=0$ ### 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 ```
Backtracking
Binary string
ABC string
Subset sum
Subset
Permutations
Group division
Knight's tour
N-queens problem
Maximum path
Knapsack
Build array
Sudoku
Minesweeper
Travelling Salesman Problem
Word search
Topic
Complete Search
Rating 800
Solution (0) Solution