Master_Prog's blog

By Master_Prog, 12 years ago, translation, In English

What is wrong in my code ?
450D - Jzzhu and Cities
7166454

  • Vote: I like it
  • -17
  • Vote: I do not like it

| Write comment?
»
12 years ago, hide # |
← Rev. 2  
Vote: I like it 0 Vote: I do not like it

Here you go:

3 1 2
2 3 1
2 1
3 3

In this test case the shortest path to city 3 is through city 2 (i.e. the shortest path starts with rails, then ends with a road). So, the answer should be 1, but your code returns 0.

In your code it seems like you do not actually consider rails in your implementation of Dijkstra's algorithm.

Good luck!

P.S.: if you wonder why you got so many 'dislikes' then consider to be more polite to the community, especially when you ask for help ;)