Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

思路

Posted by xuchang at 2010-10-28 09:24:51 on Problem 1935
以K为根建树,遍历找出必须要经过的边,得边权和为sum,
要使dis最短,则有一点可以不返回,那点不就是要到的点
中离K最远的city吗?记为MAX,则mindis=sum*2-MAX。
一开始TLE 优化了下之后发现是WA。。。想不到招了

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator