#P1392. 取数

取数

Description

In an nn-row, mm-column array of numbers, you must pick one number from each row (a total of nn numbers) and add them to get a sum. For the given array, please output the kk smallest picking methods by sum.

Input Format

The first line contains three numbers n,m,kn,m,k. Lines 2n+12\sim n+1, each line contains mm positive integers.

Output Format

One line containing kk numbers, representing the kk smallest sums when picking one number from each row.

3 3 2
1 2 3
6 3 5
4 1 2

5 6

Hint

For 20%20\% of the testdata, 1n81\le n\le 8. For 100%100\% of the testdata, 1n8001\le n\le 800, 1km8001\le k\le m\le 800. It is guaranteed that the final answer does not exceed 23112^{31}-1.

Translated by ChatGPT 5