#1269
Unrated
Kronican
시간 제한
2s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Little Mislav owns N glasses of infinite volume, and each glass contains some water. Mislav wants to drink all the water, but he doesn’t want to drink from more than K glasses. What Mislav can do with the glasses is pour the total volume of water from one glass to another. Unfortunately, it matters to Mislav what glass he picks, because not all glasses are equally distant to him. More precisely, the amount of effort it takes to pour water from glass labeled with i to glass labeled j is denoted with CijC_{ij}. Help Mislav and find the order of pouring the water from one glass to another such that the sum of effort is minimal.

입력

The first line of input contains integers N, K (1 ≤ K ≤ N ≤ 20). The following N lines contains N integers CijC_{ij} (0 ≤ CijC_{ij}10510^{5}). The i-th row and j-th column contains value CijC_{ij}. It will hold that each CiiC_{ii} is equal to 0.

출력

Output the minimal effort needed for Mislav to achieve his goal.

채점

In test cases worth 40 points total, it will hold N ≤ 10.

예제 입력 1

3 3
0 1 1
1 0 1
1 1 0

예제 출력 1

0

예제 입력 2

3 2
0 1 1
1 0 1
1 1 0

예제 출력 2

1

예제 입력 3

5 2
0 5 4 3 2
7 0 4 4 4
3 3 0 1 2
4 3 1 0 5
4 5 5 5 0

예제 출력 3

5
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.