Computer Science, asked by sravanimuvvala8, 9 months ago

Longest Possible Route
Longest Possible Route
Given an MxN matrix, with a few hurdles arbitrarily placed, calculate the cost of longest possible route from point A to point B within the matrix
Input Format:
1. First line contains 2 numbers delimited by whitespace where, first number M is number of rows and second number N is number of columns
2. Second line contains number of hurdles H followed by H lines, each line will contain one hurdle point in the matrix.
3. Next line will contain point A, starting point in the matrix.
4. Next line will contain point B , stop point in the matrix.
Output Format:
Output should display the length of the longest route from point A to point B in the matrix
Constraints:
1. The cost from one position to another will be 1 unit.
2. A location once visited in a particular path cannot be visited again.
3. A route will only consider adjacent hops. The route cannot consist of diagonal hops.
4. The position with a hurdle cannot be visited.
5. The values MxN signifies that the matrix consists of rows ranging from 0 to M-1 and columns ranging from 0 to N-1.
6. If the destination is not reachable or source/ destination overlap with hurdles, print cost as -1.
Sample Input and Output​

Answers

Answered by ricksuperbyo
0

Answer:

that will be 138954773578999 but it

Explanation:

ghiuuuhbjjjjjfgjikjhbnmmmmmm

Similar questions