K Smallest Sums
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
You're given k arrays, each array has k integers. There are k^k
ways to pick exactly one element in each array and calculate the sum of the integers. Your task is to find the k smallest sums among them.
Input
There are several test cases. The first line of each case contains an integer k (2 ≤ k ≤ 750). Each of the following k lines contains k positive integers in each array. Each of these integers does not exceed 1,000,000.
Output
For each test case print in a separate line k smallest sums in ascending order.
Examples
Input #1
Answer #1
Submissions 292
Acceptance rate 54%