Logo
(追記) (追記ここまで)

19296번 - Computing MDSST 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB134457.143%

문제

In this problem, we will consider weighted undirected graphs where all edges have positive weights.

Let $D(G,i,j)$ be the length of the shortest path in graph $G$ between vertex $i$ and vertex $j$.

We are given a complete weighted undirected graph $G$ which consists of $n$ vertices numbered from 1ドル$ to $n$. Among the spanning trees of $G,ドル the MDSST (Minimum Distance Sum Spanning Tree) is such $T$ for which the value $S(T) = \sum_{1 \leq i < j \leq n} D(T,i,j)$ is minimum. Your task is to find MDSST of $G$ and print $S(T)$.

입력

The first line contains an integer $n,ドル the number of vertices in the graph (2ドル \le n \le 15$). The $i$-th of the following $n-1$ lines contains $n-i$ integers separated by spaces. The $j$-th integer of this the line is the length of the edge between vertex $i$ and vertex $i+j$.

All the lengths are between 1ドル$ and 10ドル^9,ドル inclusive.

출력

On the first line, print one integer: the value $S(T)$ for the MDSST you found.

제한

예제 입력 1

4
3 2 1
5 6
7

예제 출력 1

18

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 5: Grand Prix of Korea F번

Contest > Open Cup > 2017/2018 Season > Stage 10: Grand Prix of Korea F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /