2324 - DS_21_CHEN_HW3 (EECS2040) Scoreboard

Time

2021/04/29 09:00:00 2021/05/10 12:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13190 The Shortest Way Back Home

13190 - The Shortest Way Back Home   

Description

 

Input

First line, you will get the row and column of the matrix.

1 <= R <= 105, 1 <= C <= 105

Second line, you will get the start position of the matrix.

0 <= X < 105, 0 <= Y < 105

Third line, you will get a 2D matrix, for each element N in the matrix:

-1 <= N <= 9

Output

The output should be the distance from root to leaf of the shortest path.

(Remember to print out "\n" after the answer)

Sample Input  Download

Sample Output  Download

Tags




Discuss