HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50434 - Row Min Subtraction

Guest
• Review clarifications (1)

Volume problems

• 50517 - Confusion Matrix
• 50866 - Buy the cheapest
• 50785 - Swimming Contest
• 51011 - Decoding the Path
• 50515 - Lines - Revisited
• 50999 - Overlapping Trips
• 50507 - Sequential Numbers
• 50449 - The biggest result
• 50434 - Row Min Subtraction
• 50442 - Polynomial Addition
• 50869 - Birthday Celebration
• 50870 - ZScore normalization
• 50513 - Climbing Up the Stairs
• 50821 - Derivative of an array
• 50854 - Area of Triangle Revised
• 50520 - Filling a Matrix Randomly
• 51019 - Finding the hidden message

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 200000/16000/2000/2000 Kb.
Question by Ibrahim Mesecan.

Row Min Subtraction

In a research, your professor has realized that the data he is working on has some noise. For this reason, he wants to subtract the smallest value of every row from the row elements. As a result, the smallest number of every row will be 0.

Question: Write a program that is going to get n rows of m numbers. Then, the program will subtract the smallest value of every row from the row elements.
Note: Pay attention that there is memory limit in this question.

Input specification
In the beginning, you will be given 2 integers:

  • the number of rows (n): an integer between 0 and 5000
  • the number of numbers in every row (m): an integer between 0 and 1000
then in the following n lines you will be given m integers which are between -10000 and 10000.

Output specification
Show m integers in n lines.

Sample Input I
3 6
5 6 1 6 1 7
10 5 15 24 13 12
9 4 16 6 7 15
Sample Output I
4 5 0 5 0 6
5 0 10 19 8 7
5 0 12 2 3 11

Explanation: The min of first row is 1, thus, 1 has been subtracted from the first row elements.
The min of the second row is 5. Similarly, 5 has been subtracted from the second row elements...

Для отправки решений необходимо выполнить вход.

www.contester.ru