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

A got AC,but my algo is O(N^3). I know algo O(N*N*logN).
Posted by Felix_Mate 6 Sep 2015 15:49
Idea is Dijkstra (N times from every node). I can proof that minimal cycle turns when we  add one edge in root tree (tree of distance).

Edited by author 06.09.2015 15:53

Edited by author 06.09.2015 15:54