ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1004. Sightseeing Trip

ice_cream can i use floyd to solve this problem? [2] // Problem 1004. Sightseeing Trip 2 Aug 2010 16:34
i solve this problem with  floyd ,but i got crash
Vitalii Arbuzov Re: can i use floyd to solve this problem? [1] // Problem 1004. Sightseeing Trip 9 Feb 2011 11:38
I think no.
After using Floyd you'll get d[i][j] - array with shortest paths and w[i][j] - array with intermediate vertexes.
However it will be impossible to find paths that does not contain duplicate vertexes (Floyd doesn't take care of that). And also Floyd will prefer short paths (e.g. 1,2,1) and it doesn't match to requirement of this problem.
So Floyd in it's original form is not applicable here.
Possibly some adoption is.
But I don't actually know how this adoption should work.

NotImplemented Re: can i use floyd to solve this problem? // Problem 1004. Sightseeing Trip 22 Feb 2014 22:40
It is applicable. You can run it instead of N Dijkstra algorithms.