Abstract Circular Cover

아직 제출이 없습니다시간 제한20초메모리 제한512 MB

문제

The time limit is a bit strict.

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

An integer cost c_i,c\_{i, \ell} is assigned to each circular segment. For each kk from 11 to nn, find the minimum total cost of exactly kk circular segments, such that each of the nn points is contained in exactly one of them.

Note that there are no properties that values c_i,c\_{i, \ell} satisfy, except being comparatively small positive integers. That is, any n×nn \times n array of integers between 11 and 10610^6 is a valid test for this problem.

입력

The first line contains an integer nn (1n8501 \leq n \leq 850), the number of points on the circle. The (i+1)(i+1)-st (0in10 \leq i \leq n - 1) of the following nn lines contains nn space-separated integers c_i,1,c_i,2,,c_i,nc\_{i, 1}, c\_{i, 2}, \ldots, c\_{i, n} (1c_i,1061 \leq c\_{i, \ell} \leq 10^6 for 1n1 \leq \ell \leq n).

출력

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