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

please help me..
Posted by double 5 Feb 2008 11:36
I don't know how to print.
I used floyd.
And who can tell me how to print the route?
3X.

Edited by author 05.02.2008 11:38
Re: please help me..
Posted by Javran 5 Jul 2009 16:27
I used floyd but I don't know how to print the path out

Waiting for help,,... +_+ ...
Re: please help me..
Posted by Baurzahn 14 Jul 2009 17:31
1)you should write recursive function which builds the shortest way
2) suppose you want to build path between i and j cities.
   what's the next city after the i-city?
   To answer this question you loop all i-th neighbors and choose some neighbor k where weight[i][k]+distance[k][j]->min,
 3) suppose you want to build path between k and j cities.
   what's the next city after the k-city? (recursively repeat it!)