K Smallest Sums
来源:UVA
标签:数据结构、优先队列
参考资料:《算法竞赛入门经典训练指南》P189
相似题目:
题目
You’re given k arrays, each array has k integers. There are 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.
输入
There will be 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. The input is terminated by end-of-file (EOF).