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

My program is 0.656 s,how can I get faster?
Posted by acmore 6 Aug 2009 08:42
My solution is O(N^4).

Edited by author 06.08.2009 08:42

Edited by author 06.08.2009 08:42
Re: My program is 0.656 s,how can I get faster?
Posted by olpetOdessaONU [1 2/3] 30 Jun 2010 00:12
You should use Dijkstra algorithm for every vertex. In algorithm you should find two different best ways from current vertex V to any other A. The summary length of this two ways is the length of the shortest cycle with vertexes A and V.