RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00236

Mars

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(1^{st}\) round, October \(20^{th}\), 2012

Scientists have discovered some strange bacteria on Mars and are now busy studying them. They have
noticed that the number of bacteria is a power of 2, since each bacterium on Mars splits into two new
bacteria (dying in the process), and it all started from a single bacterium.
Thus, in the first generation there was a single bacterium. It split into two bacteria of the second
generation, which split into four bacteria of the third generation, and so on – until the \(2^{K}\) bacteria of
generation \(K+1\) that the scientists have discovered. They have numbered the bacteria using numbers
from 1 to \(2^{K}\) in the following way:
 descendants of bacteria of the previous (K^{th}) generation are, in this order: {1, 2}, {3, 4}, {5, 6},
..., {\(2^{K} - 1\), \(2^{K}\)}
 descendants of bacteria of the older ((\(K-1\))^{th}) generation are, in this order: {1, 2, 3, 4}, {5, 6, 7,
8}, ..., {\(2^{K} - 3\), \(2^{K} - 2\), \(2^{K} - 1\), \(2^{K}\)}
 descendants of bacteria of the even older ((\(K-2\))^{th}) generation are, in this order: {1, 2, 3, 4, 5, 6,
7, 8}, ..., {\(2^{K} - 7\), \(2^{K} - 6\), \(2^{K} - 5\), \(2^{K} - 4\), \(2^{K} - 3\), \(2^{K} - 2\), \(2^{K} - 1\), \(2^{K}\)}
 ...
 descendants of the two bacteria of the second generation are, in this order: {1, 2, ..., \(2^{K}\)^{-1}} and
{\(2^{K}\)^{-1} + 1, \(2^{K}\)^{-1} + 2, ..., \(2^{K}\)}
where curly braces denote a set of descendants of a single bacteria. That is, the \(2^{K}\) bacteria of the
current generation were numbered such that descendants of any older bacterium have consecutive
numbers.
Notice that there exist many different permutations of these bacteria which still satisfy the rule that
descendants of any older bacterium have consecutive sequence numbers. Scientists want to
arrange the bacteria into such a sequence which also has the minimum possible length. The length of
a bacteria sequence is the sum of distances between all neighbouring bacteria pairs.
Specifically, there is a certain quantifiable repulsion between every two bacteria, which is the minimum
distance between them if they are next to each other in the sequence. (Repulsion plays no role between
bacteria that are not immediate neighbours in the sequence.) Given the repulsion values for all bacteria
pairs, find the minimum possible length of a bacteria sequence (permutation) satisfying the descendant
rule given above.
\(1^{st}\) round, October \(20^{th}\), 2012

제약
입력 형식

The first line of input contains the positive integer K (\(1 \le K \le 9\)) from the problem statement.
Each of the following \(2^{K}\) lines contains \(2^{K}\) integers from the interval [0, \(10^{6}\)]. These \(2^{K} \times 2^{K}\)numbers
represent repulsion between bacteria pairs: the number in row m and column n is the repulsion
between bacteria m and n. This number will, of course, be equal to the number in row n and column
m. For \(m = n\) the number will be 0.

출력 형식

The first and only line of output should contain the minimum possible length of a bacteria sequence
satisfying the constraints.

예제 1
입력
2
0 7 2 1
7 0 4 3
2 4 0 5
1 3 5 0
출력
13
예제 2
입력
3
0 2 6 3 4 7 1 3
2 0 7 10 9 1 3 6
6 7 0 3 5 6 5 5
3 10 3 0 9 8 9 7
4 9 5 9 0 9 8 4
7 1 6 8 9 0 8 7
1 3 5 9 8 8 0 10
3 6 5 7 4 7 10 0
출력
32
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2012/2013 Contest 1

평가 및 의견

Mars

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Mars

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8