시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
20 초 512 MB 0 0 0 0.000%

문제

The time limit is a bit strict.

There are $n$ distinct points on a circle, numbered from $0$ to $n - 1$ inclusive in the clockwise order. A circular segment of length $\ell$ ($1 \leq \ell \leq n$) with start at $i$ ($0 \leq i \leq n - 1$) is a tuple of $\ell$ consecutive points in the clockwise order, starting with $i$ (in other words, a tuple of points with numbers $i, (i + 1) \bmod n, (i + 2) \bmod n, \ldots, (i + \ell - 1) \bmod n$). Circular segments of length $n$ with starts at $0, 1, \ldots, n - 1$ are considered to be pairwise different, despite containing the same set of points.

An integer cost $c_{i, \ell}$ is assigned to each circular segment. For each $k$ from $1$ to $n$, find the minimum total cost of exactly $k$ circular segments, such that each of the $n$ points is contained in exactly one of them.

Note that there are no properties that values $c_{i, \ell}$ satisfy, except being comparatively small positive integers. That is, any $n \times n$ array of integers between $1$ and $10^6$ is a valid test for this problem.

입력

The first line contains an integer $n$ ($1 \leq n \leq 850$), the number of points on the circle. The $(i+1)$-st ($0 \leq i \leq n - 1$) of the following $n$ lines contains $n$ space-separated integers $c_{i, 1}, c_{i, 2}, \ldots, c_{i, n}$ ($1 \leq c_{i, \ell} \leq 10^6$ for $1 \leq \ell \leq n$).

출력

Output $n$ space-separated integers: $k$-th of them should be the minimum total cost of $k$ circular segments that cover every point exactly once.

예제 입력 1

3
10 12 23
7 4 11
8 5 3

예제 출력 1

3 12 25

예제 입력 2

1
15

예제 출력 2

15