Artem is building another robot. He has a network a comprising of n lines and m sections. The cell situated on the I-th line from the top and the j-th segment from the left has a worth ai,j written in it.    In the event that two nearby cells contain a similar worth, the robot will break. A lattice is called acceptable if no two adjoining cells contain a similar worth, where two

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.

Artem is building another robot. He has a network a comprising of n lines and m sections. The cell situated on the I-th line from the top and the j-th segment from the left has a worth ai,j written in it. 

 

In the event that two nearby cells contain a similar worth, the robot will break. A lattice is called acceptable if no two adjoining cells contain a similar worth, where two cells are called nearby on the off chance that they share a side. 

 

Artem needs to increase the qualities in certain cells by one to make a decent. 

 

All the more officially, find a decent network b that fulfills the accompanying condition — 

 

For all substantial (i,j), either bi,j=ai,j or bi,j=ai,j+1. 

 

For the imperatives of this issue, it tends to be shown that such a framework b consistently exists. In case there are a few such tables, you can output any of them. Kindly note that you don't need to limit the number of additions. 

 

Input 

 

Each test contains numerous experiments. The principal line contains the number of experiments t (1≤t≤10). Portrayal of the experiments follows. 

 

The principal line of each experiment contains two integers n,m (1≤n≤100, 1≤m≤100) — the number of lines and segments, individually. 

 

The accompanying n lines each contain m integers. The j-th integer in the I-th line is ai,j (1≤ai,j≤109). 

 

Output 

 

For each case, output n lines each containing m integers. The j-th integer in the I-th line is bi,j.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Minimum and Maximum
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education