Maximum Daily Revenue

Company: Natwest

Difficulty: medium

Problem Statement

Maximum Daily Revenue A company keeps a sales record of N products over M days. For every one of the M days the record stores the revenue that each of the N products brought in on that day; a revenue can be positive or negative, because a product may lose money on a bad day. The company wants to know, for each day separately, the single highest revenue any one product produced on that day. Write an algorithm that reports that value for every day, in day order. Input Format The first line contains two space-separated integers days ( M ) and products ( N ). Each of the next M lines contains N space-separated integers salesRecord[i][j] -- the revenue product j produced on day i . Output Format Print M space-separated integers on a single line: the highest revenue received on day 1 , on day 2 , and so on up to day M . Constraints 1 <= M <= 1000 (inferred -- the source gives no limits; this keeps the printed line inside the judge's output cap) 1 <= N <= 3500 (inferred -- the sou