Liam is planning out his route for an upcoming nature hike. Unfortunately, the region that he plans on hiking through is notoriously muddy, so in order to prevent his floral shirt from getting covered with mud, he has decided to pick a route for which the maximum depth of mud encountered is minimized. The terrain is modelled as a two-dimensional grid, with nonnegative integers giving the depth of the mud in each cell in micrometers (millionths of a meter). The hike must begin at one of the cells in the leftmost column of the grid and finish at one of the cells in the rightmost column of the grid. Image by Kerstin Herrmann (Pixabay), Public Domain Liam is allowed to move either north, south, east, or west, but he cannot travel diagonally. Input The first line of input contains two space-separated integers, r and c (2 < r, c<1000), indicating the number of rows and the number of columns in the grid, respectively. Each of the next r lines contains c space-separated integers, indicating the depth of mud in the cells of the corresponding grid row from left to right. Each depth is measured in micrometers and is given as an integer in the interval [0,1 000 000]. Output The output should contain a single integer, the depth of the deepest mud that Liam is forced to hike through if his route minimizes this value. Sample Input 1 Sample Output 1 5 4 3 2 1 0 8 37 3 5 3 1 2 4 9 0 4 6 5 3 2 3 Sample Input 2 Sample Output 2 2 2 2 3 0 1 2

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Use c# for the following case 

 

Liam is planning out his route for an upcoming nature hike.
Unfortunately, the region that he plans on hiking through is
notoriously muddy, so in order to prevent his floral shirt from
getting covered with mud, he has decided to pick a route for
which the maximum depth of mud encountered is minimized.
The terrain is modelled as a two-dimensional grid, with
nonnegative integers giving the depth of the mud in each cell
in micrometers (millionths of a meter). The hike must begin
at one of the cells in the leftmost column of the grid and
finish at one of the cells in the rightmost column of the grid.
Image by Kerstin Herrmann (Pixabay), Public Domain
Liam is allowed to move either north, south, east, or west, but he cannot travel diagonally.
Input
The first line of input contains two space-separated integers, r and c (2 < r,c< 1000), indicating the number
of rows and the number of columns in the grid, respectively. Each of the next r lines contains c space-separated
integers, indicating the depth of mud in the cells of the corresponding grid row from left to right. Each depth is
measured in micrometers and is given as an integer in the interval [0,1 000 000].
Output
The output should contain a single integer, the depth of the deepest mud that Liam is forced to hike through if
his route minimizes this value.
Sample Input 1
Sample Output 1
5 4
2 10 8
37 3 5
3 1 2 4
9 0 4 6
5 3 2 3
3
Sample Input 2
Sample Output 2
2 2
2
3 0
1 2
Transcribed Image Text:Liam is planning out his route for an upcoming nature hike. Unfortunately, the region that he plans on hiking through is notoriously muddy, so in order to prevent his floral shirt from getting covered with mud, he has decided to pick a route for which the maximum depth of mud encountered is minimized. The terrain is modelled as a two-dimensional grid, with nonnegative integers giving the depth of the mud in each cell in micrometers (millionths of a meter). The hike must begin at one of the cells in the leftmost column of the grid and finish at one of the cells in the rightmost column of the grid. Image by Kerstin Herrmann (Pixabay), Public Domain Liam is allowed to move either north, south, east, or west, but he cannot travel diagonally. Input The first line of input contains two space-separated integers, r and c (2 < r,c< 1000), indicating the number of rows and the number of columns in the grid, respectively. Each of the next r lines contains c space-separated integers, indicating the depth of mud in the cells of the corresponding grid row from left to right. Each depth is measured in micrometers and is given as an integer in the interval [0,1 000 000]. Output The output should contain a single integer, the depth of the deepest mud that Liam is forced to hike through if his route minimizes this value. Sample Input 1 Sample Output 1 5 4 2 10 8 37 3 5 3 1 2 4 9 0 4 6 5 3 2 3 3 Sample Input 2 Sample Output 2 2 2 2 3 0 1 2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY