Marks :10
: 2 | : 0
The Chernobyl disaster happened on April $$$26,1986$$$, at the No.$$$4$$$ reactor of the Chernobyl Nuclear Power Plant. In terms of both cost and casualties,it is one of the most devastating nuclear disasters in history.
After the tragedy, scientists retrieved a large number of important documents from the site which contained nuclear power emission data in $$$n$$$ rows and $$$m$$$ columns. This information represented the power emitted by $$$n$$$ nuclear reactors on hourly basis during $$$m$$$ hours. Because these records were handwritten,scientists intend to scan them using optical character scanners to tum numbers into machine encoded text. However, some of the numbers are illegible owing to catastrophic damage.
Scientists opted to reconstruct the missing data by using the rest of the data from that column. Can you help them with a program that detects the minimum number in a column and replaces it with the documents damaged space that is indicated as $$$-1.$$$
Note: If there are all $$$-1$$$ in a column, you can skip that column.
The first line of input contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of testcases. The description of $$$t$$$ testcases follows.
The first line of each testcase contains two space separated integers $$$n$$$ and $$$m$$$ $$$(1 \le n,m \le 10^5)$$$ — the dimensions of the matrix.
The next $$$n$$$ lines contain $$$m$$$ integers each denoting the matrix. Each integer will be in the range $$$[-1,10^9]$$$.
It is guaranteed that the sum of $$$n \cdot m$$$ over all testcases does not exceed $$$10^6$$$.
For each testcase, print the matrix after replacing the missing data as explained in the problem statement.
14 42 4 6 -1-1 4 5 67 5 8 34 3 6 7
2 4 6 3 2 4 5 6 7 5 8 3 4 3 6 7
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.