很好的一道treedp,当然也挺烦的首先不难想到先求出一个直径,然后穷举每条边,看他删除之后直径大小是否会变,变了的话就是必须经过的边下面我们就要想怎么优化,本人语言表达略差,还是配合程序说吧. type node=record point,next:longint; cost:int64; end; ..] of int64; pr,fr:..,..] of longint; g,h:..,..] of int64; p:..] of longint; edge:..] of node; v:…