## Shortest Path

Given a graph as an adjacency matrix, find the shortest path from the first to the last vertex.### Input

N ≤ 100, the number of vertices.The adjacency matrix - N rows of N numbers.

The first row represents the first vertex, and similarly the last row = the last vertex.

### Output

The distance from the first vertex to the last one.### Sample Input

3 0 1 0 0 0 1 0 0 0

### Sample Output

2

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Jun 28, 2013

**Problem Types:**[Show]

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

TheBoss77on Feb 22, 2020 - 2:54:26 am UTC helpChinadollon Feb 17, 2017 - 9:25:52 pm UTC weight?jargonon Feb 18, 2017 - 10:29:19 pm UTC Re: weight?4Dmovieon Nov 24, 2016 - 5:02:21 pm UTCKiritoon Nov 25, 2016 - 12:50:18 am UTC Re: ...http://wcipeg.com/wiki/Graph_theory#Adjacency_matrix

Guru_Charison Apr 15, 2015 - 4:32:09 pm UTCwgma00on Apr 16, 2015 - 4:56:26 am UTC Re: ...Guru_Charison Apr 16, 2015 - 10:05:03 am UTC Re: ...jargonon Apr 17, 2015 - 3:15:40 am UTC Re: ...