Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Problem Description A traffic flow grid is a conceptual representation used in transportation planning and traffic engineering to model and analyze the movement of vehicles
Problem Description A traffic flow grid is a conceptual representation used in transportation planning and traffic engineering to model and analyze the movement of vehicles through a network of intersections in the city called as junctions. A traffic flow grid is akin to a matrix, with rows and columns denoting various junctions, and matrix cell values symbolizing the traffic flow in that junction. In the era of screens and swipes, traffic's stage can be seen on mobile! Srihan finds himself caught in traffic on his way to the workplace. To speed up his journey, he opts to assess the traffic flow grid and chooses a quicker route. He currently resides at coordinates i j and his office is located at coordinates a b in the traffic grid. Given a rule that from a given junction, he can only go to right or down junction junction is a cell, in terms of matrix Could you assist him in finding a faster route to reach his workplace? Constraints Note that the provided positions in the input are indexed starting from where left top is n m traffic flow Input First line consists of two space separated integers n m denoting the number of rows and columns in the traffic grid. Next n lines consists of m space separated integers denoting the traffic flow. The value at i j indicates the traffic flow at junction i and j Line n consists of two space separated integers denoting the coordinates of Srihan's current position. Line n consists of two separated integers denoting the coordinates of Srihan's workplace. Output Single integer denoting the the minimum traffic flow Srihan must navigate to reach his workplace. In case there is no path from his current location to workplace, print Time Limit secs Examples Example Input Output Explanation Srihan will choose the path The total traffic flow Srihan navigated is which is the minimum possible. Example Input Output Explanation Srihan will choose the path The total traffic flow Srihan navigated is which is the minimum possible.
Problem Description
A traffic flow grid is a conceptual representation used in transportation planning and traffic engineering to model and analyze the movement of vehicles through a network of intersections in the city called as junctions. A traffic flow grid is akin to a matrix, with rows and columns denoting various junctions, and matrix cell values symbolizing the traffic flow in that junction. In the era of screens and swipes, traffic's stage can be seen on mobile!
Srihan finds himself caught in traffic on his way to the workplace. To speed up his journey, he opts to assess the traffic flow grid and chooses a quicker route. He currently resides at coordinates i j and his office is located at coordinates a b in the traffic grid. Given a rule that from a given junction, he can only go to right or down junction junction is a cell, in terms of matrix Could you assist him in finding a faster route to reach his workplace?
Constraints
Note that the provided positions in the input are indexed starting from where left top is
n m
traffic flow
Input
First line consists of two space separated integers n m denoting the number of rows and columns in the traffic grid.
Next n lines consists of m space separated integers denoting the traffic flow. The value at i j indicates the traffic flow at junction i and j
Line n consists of two space separated integers denoting the coordinates of Srihan's current position.
Line n consists of two separated integers denoting the coordinates of Srihan's workplace.
Output
Single integer denoting the the minimum traffic flow Srihan must navigate to reach his workplace. In case there is no path from his current location to workplace, print
Time Limit secs
Examples
Example
Input
Output
Explanation
Srihan will choose the path
The total traffic flow Srihan navigated is which is the minimum possible.
Example
Input
Output
Explanation
Srihan will choose the path
The total traffic flow Srihan navigated is which is the minimum possible.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started