eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Sightseeing Tour

Sightseeing Tour

KM city has \textbf{N} sightseeing areas. Currently every pair of area is connected by a bidirectional road. However for some reason, Mr.KM, the mayor of this city, decided to make all of these roads one-way . It costs \textbf{C_ij} dollars to renovate the road between area \textbf{i} and area \textbf{j} to a one-way road from area \textbf{i} to area \textbf{j}. Of course, Mr.KM is economic and wants to minimize the total cost of the renovation. On the other hand, because tourism is the most important industry for KM city, there must exists a tour that goes through all the sightseeing areas, visiting each area exactly once. The first and last area of the path need not to be the same. Can you calculate the minimum total cost required for the renovation, given this situation? \InputFile The first line contains the number of sightseeing area \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100}). Next \textbf{N} lines describe the integer matrix \textbf{C}, where the \textbf{j}^th element of the \textbf{i}^th row of the input describes \textbf{C_ij} (\textbf{0} ≤ \textbf{Cij} ≤ \textbf{1000000}). For each \textbf{i}, you can assume \textbf{C_ii} is always zero. \OutputFile Output the minimum cost in a line.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
3
0 2 7
2 0 4
5 8 0
Выходные данные #1
11
Источник The 2011 35th Annual ACM Programming Contest Winter Camp